cmake/nc_cxx.cmake

37 lines
1.2 KiB
CMake

include (compile_flag)
include (test_restrict)
###############################################################################
append_compile_flag (-std=c++1z)
###############################################################################
# find the gcc experimental 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.
foreach(lib "" stdc++fs)
if (NOT __nc_cxx_stdcxxfs)
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)
list (APPEND LIBS ${lib})
endif ()
endif ()
endforeach()
###############################################################################
test_restrict(RESTRICT_KEYWORD)
add_definitions("-Drestrict=${RESTRICT_KEYWORD}")
###############################################################################
append_compile_flag("-pipe")
append_compile_flag("-fno-deduce-init-list")
append_compile_flag("-fvisibility=hidden")