Revert "cxx: remove test for the filesystem library"

This reverts commit 874bbb2413.
This commit is contained in:
Danny Robson 2019-05-06 13:02:15 +10:00
parent 874bbb2413
commit e46716472a

View File

@ -33,6 +33,39 @@ append_compile_flag ("/std:c++latest")
# libstdc++ headers don't behave well under c++17/clang.
append_compile_flag ("-stdlib=libc++")
###############################################################################
# find the gcc or clang filesystem library and append to libs if needed
#
# note, we specifically _cannot_ use find_library because it just makes wild
# hardcoded guess and doesn't respect _all_ the system paths; specifically
# something like /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so won't get
# discovered.
if (NOT DEFINED __nc_cxx_stdcxxfs)
foreach(lib "" "c++fs" "c++experimental" "stdc++fs")
if (NOT __nc_cxx_stdcxxfs)
message (STATUS "Trying c++fs library '${lib}'")
try_compile(
__nc_cxx_stdcxxfs ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/cmake/nc_cxx_stdcxxfs.cpp
LINK_LIBRARIES
${lib})
if (__nc_cxx_stdcxxfs)
set (__nc_cxx_stdcxxfs "${lib}" CACHE INTERNAL "library required for c++ filesystem")
endif ()
endif ()
endforeach()
if (NOT __nc_cxx_stdcxxfs)
message (FATAL_ERROR "Could not locate the required c++fs library")
endif ()
message (STATUS "Using c++fs library ${__nc_cxx_stdcxxfs}")
endif ()
set(NC_CXX_STDCXXFS ${__nc_cxx_stdcxxfs})
###############################################################################
test_restrict(RESTRICT_KEYWORD)