Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: fix #842, always link stdc++fs if linux & gcc. #846

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ target_include_directories(utils

# We may need to link filesystem library manually.
find_library(STD_CPP_FS stdc++fs)
# Library found -> link against it.
if (STD_CPP_FS)
message(STATUS "-- Linking with ${STD_CPP_FS} library")
message(STATUS "-- Library stdc++fs found -> Linking with ${STD_CPP_FS}")
target_link_libraries(utils
PRIVATE
stdc++fs
)
# Library not found & (Linux, BSD, Solaris, Minix) & GCC
elseif(UNIX AND (NOT APPLE) AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(STATUS "-- Library stdc++fs NOT found & Linux+GCC -> Linking with stdc++fs")
target_link_libraries(utils
PRIVATE
stdc++fs
)
# Library not found -> hope compiler does not need it.
else()
message(STATUS "-- Library stdc++fs NOT FOUND -> linking utils without stdc++fs library")
message(STATUS "-- Library stdc++fs NOT found -> linking utils without stdc++fs library")
endif()

# Disable the min() and max() macros to prevent errors when using e.g.
Expand Down