Skip to content

Commit a1feb8f

Browse files
[CMake] Solution for linking filesystem (libstdc++fs) issues with GCC8 in Centos (#365)
* [CMake] Solution for linking `filesystem` issues with GCC8 in Centos * Fix version check
1 parent b43b70e commit a1feb8f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ elseif(${CMAKE_COMPILER_IS_GNUCXX})
9797
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override -Wignored-qualifiers")
9898
endif()
9999

100+
# Always link with libstdc++fs.a when using GCC 8 (greater than 7 and less than 9)
101+
# Note: This command makes sure that this option comes pretty late on the cmdline.
102+
link_libraries("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,7.0>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:-lstdc++fs>")
100103
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
101104
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
102105
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89")

0 commit comments

Comments
 (0)