1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 11:10:33 +00:00

Fix linking for std::filesystem in GCC 8

This commit is contained in:
Carles Fernandez 2021-01-31 14:13:25 +01:00
parent 3c17f0a9a7
commit 2a82c27954
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 17 additions and 9 deletions

View File

@ -122,7 +122,10 @@ endif()
# All of our tests require C++17 or later
set(OLD_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_CXX_STANDARD 17)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "9.0.0"))
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "8.0.0"))
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99")
set(UNDEFINED_BEHAVIOR_WITHOUT_LINKING TRUE)
endif()
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99"))
@ -207,9 +210,10 @@ if(CXX_FILESYSTEM_HAVE_FS)
]] code @ONLY)
# Try to compile a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
if(NOT UNDEFINED_BEHAVIOR_WITHOUT_LINKING)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
endif()
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})

View File

@ -119,8 +119,11 @@ if(FILESYSTEM_FIND_QUIETLY)
set(CMAKE_REQUIRED_QUIET ${FILESYSTEM_FIND_QUIETLY})
endif()
# All of our tests require C++17 or later
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "9.0.0"))
set(CMAKE_CXX_STANDARD 17)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "8.0.0"))
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99")
set(UNDEFINED_BEHAVIOR_WITHOUT_LINKING TRUE)
endif()
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99"))
@ -205,9 +208,10 @@ if(CXX_FILESYSTEM_HAVE_FS)
]] code @ONLY)
# Try to compile a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
if(NOT UNDEFINED_BEHAVIOR_WITHOUT_LINKING)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
endif()
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})