From a0db3380b1d18b330f0260d7f83486ab29076c7d Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 24 Oct 2020 10:55:35 +0200 Subject: [PATCH] Detect which file-system-header to include more reliably. --- CMakeLists.txt | 3 +++ src/fs-compat.hpp.in | 2 ++ src/libravatarserv.hpp | 20 ++++++-------------- 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 src/fs-compat.hpp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index b8991b8..bd3a0fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,9 @@ configure_file( "${PROJECT_SOURCE_DIR}/src/version.hpp.in" "${PROJECT_BINARY_DIR}/version.hpp") +# Include or . +configure_file(fs-compat.hpp.in fs-compat.hpp @ONLY) + file(GLOB sources src/*.cpp) add_executable(${PROJECT_NAME} ${sources}) target_include_directories(${PROJECT_NAME} diff --git a/src/fs-compat.hpp.in b/src/fs-compat.hpp.in new file mode 100644 index 0000000..ca15c69 --- /dev/null +++ b/src/fs-compat.hpp.in @@ -0,0 +1,2 @@ +#include <@CXX_FILESYSTEM_HEADER@> +namespace fs = @CXX_FILESYSTEM_NAMESPACE@; diff --git a/src/libravatarserv.hpp b/src/libravatarserv.hpp index 7bcac62..41dcd1d 100644 --- a/src/libravatarserv.hpp +++ b/src/libravatarserv.hpp @@ -1,5 +1,5 @@ /* This file is part of libravatarserv. - * Copyright © 2018 tastytea + * Copyright © 2018, 2020 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,20 +17,12 @@ #ifndef LIBRAVATARSERV_HPP #define LIBRAVATARSERV_HPP -#if __cplusplus >= 201703L - #include -#else - #include -#endif -#include -#include -#include +#include "fs-compat.hpp" + +#include +#include +#include -#if __cplusplus >= 201703L - namespace fs = std::filesystem; -#else - namespace fs = std::experimental::filesystem; -#endif using std::string; using std::uint16_t; using std::uint8_t;