Fixed std::filesystem library linking for gcc>=9

libstdc++fs may not be present in the system, as std::filesystem is included in libstdc++ starting from gcc9, so a conditional statement has been added to CMakeLists.txt to handle linking depending on the compiler version.
This commit is contained in:
nakmak98
2025-11-09 18:01:44 +03:00
parent 94d86f5bc6
commit c3bcac7085
+1 -1
View File
@@ -12,7 +12,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include_directories(SYSTEM /usr/local/include)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
link_libraries(stdc++fs)
link_libraries( "$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:-lstdc++fs>" )
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN)
else()