1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

include <filesystem> directly and set minimum required compiler versions for gcc and clang in cmake file

This commit is contained in:
Sonja Happ 2021-08-17 14:30:56 +02:00 committed by Steffen Vogel
parent b57a660bba
commit bfa51b2585
3 changed files with 18 additions and 22 deletions

View file

@ -48,6 +48,19 @@ if(APPLE)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/opt/local/lib/pkgconfig")
endif()
# check compiler version
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 8
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
message(FATAL_ERROR "GCC version must be at least 8!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# require at least clang 7
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)
message(FATAL_ERROR "Clang version must be at least 7!")
endif()
endif()
include(FindPkgConfig)
include(CheckIncludeFile)
include(FeatureSummary)

View file

@ -25,23 +25,15 @@
#include <cstdio>
#include <unistd.h>
#include <functional>
#include <regex>
#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
error "Missing the <filesystem> header."
#endif
#include <filesystem>
#include <jansson.h>
#include <villas/node/config.h>
#include <villas/log.hpp>
namespace fs = std::filesystem;
namespace villas {
namespace node {

View file

@ -23,21 +23,11 @@
#include <unistd.h>
#include <libgen.h>
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
#if __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
error "Missing the <filesystem> header."
#endif
#include <filesystem>
#include <villas/utils.hpp>
#include <villas/log.hpp>
#include <villas/config.hpp>
@ -47,6 +37,7 @@
using namespace villas;
using namespace villas::node;
namespace fs = std::filesystem;
Config::Config() :
logger(logging.get("config")),