Add compatibility for GCC-7.
continuous-integration/drone/push Build is failing Details

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)
pkg_check_modules(cgicc REQUIRED IMPORTED_TARGET cgicc)
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)
@ -14,6 +16,9 @@ target_sources(${PROJECT_NAME}
unset(sources_src)
unset(headers_src)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(${PROJECT_NAME}
PRIVATE PkgConfig::cgicc nlohmann_json std::filesystem)

View File

@ -15,11 +15,11 @@
*/
#include "cgi.hpp"
#include "fs-compat.hpp"
#include <cgicc/Cgicc.h>
#include <exception>
#include <filesystem>
#include <fstream>
#include <ios>
#include <iostream>
@ -42,8 +42,6 @@ using std::string_view;
using std::stringstream;
using std::vector;
namespace fs = std::filesystem;
entry_type parse_formdata()
{
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 "fs-compat.hpp"
#include "json.hpp"
#include <filesystem>
#include <iostream>
using std::cout;
namespace fs = std::filesystem;
using namespace FediBlock;
void print_debug(const entry_type &entry)