1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-12 02:10:34 +00:00

Allow volk-gnsssdr to be built with std::experimental::filesystem if found

This commit is contained in:
Carles Fernandez 2019-06-11 22:56:24 +02:00
parent d89710e375
commit c9822a435c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 24 additions and 5 deletions

View File

@ -229,8 +229,12 @@ if(CXX_FILESYSTEM_HAVE_FS)
endif()
if(can_link)
add_library(std::filesystem INTERFACE IMPORTED)
target_compile_features(std::filesystem INTERFACE cxx_std_17)
if(CMAKE_VERSION VERSION_LESS 3.12)
add_library(std::filesystem INTERFACE IMPORTED GLOBAL)
else()
add_library(std::filesystem INTERFACE IMPORTED)
target_compile_features(std::filesystem INTERFACE cxx_std_17)
endif()
set(_found TRUE)
if(CXX_FILESYSTEM_NO_LINK_NEEDED)

View File

@ -80,7 +80,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_VERSION VERSION_LESS 3.8)
set(FILESYSTEM_FOUND FALSE)
else()
find_package(FILESYSTEM)
find_package(FILESYSTEM COMPONENTS Final Experimental)
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)

View File

@ -60,6 +60,9 @@ add_executable(volk_gnsssdr_profile
if(${FILESYSTEM_FOUND})
add_definitions(-DHAS_STD_FILESYSTEM=1)
if(${find_experimental})
add_definitions(-DHAS_STD_FILESYSTEM_EXPERIMENTAL=1)
endif()
target_link_libraries(volk_gnsssdr_profile PRIVATE std::filesystem)
endif()

View File

@ -23,7 +23,11 @@
#include "volk_gnsssdr/volk_gnsssdr_prefs.h" // for volk_gnsssdr_get_config_path
#include "volk_gnsssdr_option_helpers.h" // for option_list, option_t
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
@ -38,7 +42,11 @@
#include <vector> // for vector, vector<>::const_..
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
namespace fs = std::experimental::filesystem;
#else
namespace fs = std::filesystem;
#endif
#else
namespace fs = boost::filesystem;
#endif

View File

@ -228,8 +228,12 @@ if(CXX_FILESYSTEM_HAVE_FS)
endif()
if(can_link)
add_library(std::filesystem INTERFACE IMPORTED)
target_compile_features(std::filesystem INTERFACE cxx_std_17)
if(CMAKE_VERSION VERSION_LESS 3.12)
add_library(std::filesystem INTERFACE IMPORTED GLOBAL)
else()
add_library(std::filesystem INTERFACE IMPORTED)
target_compile_features(std::filesystem INTERFACE cxx_std_17)
endif()
set(_found TRUE)
if(CXX_FILESYSTEM_NO_LINK_NEEDED)