mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-27 09:24:52 +00:00
Allow volk-gnsssdr to be built with std::experimental::filesystem if found
This commit is contained in:
parent
d89710e375
commit
c9822a435c
@ -229,8 +229,12 @@ if(CXX_FILESYSTEM_HAVE_FS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(can_link)
|
if(can_link)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_library(std::filesystem INTERFACE IMPORTED GLOBAL)
|
||||||
|
else()
|
||||||
add_library(std::filesystem INTERFACE IMPORTED)
|
add_library(std::filesystem INTERFACE IMPORTED)
|
||||||
target_compile_features(std::filesystem INTERFACE cxx_std_17)
|
target_compile_features(std::filesystem INTERFACE cxx_std_17)
|
||||||
|
endif()
|
||||||
set(_found TRUE)
|
set(_found TRUE)
|
||||||
|
|
||||||
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
|
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
|
||||||
|
@ -80,7 +80,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
if(CMAKE_VERSION VERSION_LESS 3.8)
|
if(CMAKE_VERSION VERSION_LESS 3.8)
|
||||||
set(FILESYSTEM_FOUND FALSE)
|
set(FILESYSTEM_FOUND FALSE)
|
||||||
else()
|
else()
|
||||||
find_package(FILESYSTEM)
|
find_package(FILESYSTEM COMPONENTS Final Experimental)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
|
||||||
|
@ -60,6 +60,9 @@ add_executable(volk_gnsssdr_profile
|
|||||||
|
|
||||||
if(${FILESYSTEM_FOUND})
|
if(${FILESYSTEM_FOUND})
|
||||||
add_definitions(-DHAS_STD_FILESYSTEM=1)
|
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)
|
target_link_libraries(volk_gnsssdr_profile PRIVATE std::filesystem)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -23,7 +23,11 @@
|
|||||||
#include "volk_gnsssdr/volk_gnsssdr_prefs.h" // for volk_gnsssdr_get_config_path
|
#include "volk_gnsssdr/volk_gnsssdr_prefs.h" // for volk_gnsssdr_get_config_path
|
||||||
#include "volk_gnsssdr_option_helpers.h" // for option_list, option_t
|
#include "volk_gnsssdr_option_helpers.h" // for option_list, option_t
|
||||||
#if HAS_STD_FILESYSTEM
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
#else
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
||||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
@ -38,7 +42,11 @@
|
|||||||
#include <vector> // for vector, vector<>::const_..
|
#include <vector> // for vector, vector<>::const_..
|
||||||
|
|
||||||
#if HAS_STD_FILESYSTEM
|
#if HAS_STD_FILESYSTEM
|
||||||
|
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||||
|
namespace fs = std::experimental::filesystem;
|
||||||
|
#else
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
#endif
|
#endif
|
||||||
|
@ -228,8 +228,12 @@ if(CXX_FILESYSTEM_HAVE_FS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(can_link)
|
if(can_link)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_library(std::filesystem INTERFACE IMPORTED GLOBAL)
|
||||||
|
else()
|
||||||
add_library(std::filesystem INTERFACE IMPORTED)
|
add_library(std::filesystem INTERFACE IMPORTED)
|
||||||
target_compile_features(std::filesystem INTERFACE cxx_std_17)
|
target_compile_features(std::filesystem INTERFACE cxx_std_17)
|
||||||
|
endif()
|
||||||
set(_found TRUE)
|
set(_found TRUE)
|
||||||
|
|
||||||
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
|
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
|
||||||
|
Loading…
Reference in New Issue
Block a user