Add compatibility for GCC-7.
Some checks failed
continuous-integration/drone/push Build is failing

In GCC-7 filesystem is in std::experimental.
This commit is contained in:
tastytea 2020-06-29 23:15:14 +02:00
parent a9d3ab7aeb
commit b4c4393cd8
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 10 additions and 6 deletions

View File

@ -3,7 +3,9 @@ include(GNUInstallDirs)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(cgicc REQUIRED IMPORTED_TARGET cgicc) pkg_check_modules(cgicc REQUIRED IMPORTED_TARGET cgicc)
find_package(nlohmann_json REQUIRED CONFIG) find_package(nlohmann_json REQUIRED CONFIG)
find_package(Filesystem REQUIRED) find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
configure_file(fs-compat.hpp.in fs-compat.hpp @ONLY)
add_executable(${PROJECT_NAME} main.cpp) add_executable(${PROJECT_NAME} main.cpp)
@ -14,6 +16,9 @@ target_sources(${PROJECT_NAME}
unset(sources_src) unset(sources_src)
unset(headers_src) unset(headers_src)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
PRIVATE PkgConfig::cgicc nlohmann_json std::filesystem) PRIVATE PkgConfig::cgicc nlohmann_json std::filesystem)

View File

@ -15,11 +15,11 @@
*/ */
#include "cgi.hpp" #include "cgi.hpp"
#include "fs-compat.hpp"
#include <cgicc/Cgicc.h> #include <cgicc/Cgicc.h>
#include <exception> #include <exception>
#include <filesystem>
#include <fstream> #include <fstream>
#include <ios> #include <ios>
#include <iostream> #include <iostream>
@ -42,8 +42,6 @@ using std::string_view;
using std::stringstream; using std::stringstream;
using std::vector; using std::vector;
namespace fs = std::filesystem;
entry_type parse_formdata() entry_type parse_formdata()
{ {
entry_type entry; entry_type entry;

2
src/fs-compat.hpp.in Normal file
View File

@ -0,0 +1,2 @@
#include <@CXX_FILESYSTEM_HEADER@>
namespace fs = @CXX_FILESYSTEM_NAMESPACE@;

View File

@ -15,14 +15,13 @@
*/ */
#include "cgi.hpp" #include "cgi.hpp"
#include "fs-compat.hpp"
#include "json.hpp" #include "json.hpp"
#include <filesystem>
#include <iostream> #include <iostream>
using std::cout; using std::cout;
namespace fs = std::filesystem;
using namespace FediBlock; using namespace FediBlock;
void print_debug(const entry_type &entry) void print_debug(const entry_type &entry)