2017-01-25 18:46:41 +11:00
|
|
|
###############################################################################
|
|
|
|
if (__nc_cxx)
|
|
|
|
return ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set (__nc_cxx TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2017-01-17 19:20:12 +11:00
|
|
|
include (compile_flag)
|
|
|
|
include (test_restrict)
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2017-01-23 14:55:07 +11:00
|
|
|
append_compile_flag ("-std=c++1z")
|
|
|
|
append_compile_flag ("-fpermissive")
|
|
|
|
append_compile_flag ("/std:c++latest")
|
2017-01-17 19:20:12 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# find the gcc experimental filesystem library and append to libs if needed
|
2017-01-17 21:28:04 +11:00
|
|
|
#
|
|
|
|
# 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.
|
2017-01-18 21:43:30 +11:00
|
|
|
if (NOT DEFINED __nc_cxx_stdcxxfs)
|
|
|
|
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)
|
|
|
|
set (__nc_cxx_stdcxxfs "${lib}" CACHE INTERNAL "library required for c++ filesystem")
|
|
|
|
endif ()
|
2017-01-17 21:28:04 +11:00
|
|
|
endif ()
|
2017-01-18 21:43:30 +11:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if (NOT __nc_cxx_stdcxxfs)
|
|
|
|
set (__nc_cxx_stdcxxfs)
|
2017-01-17 21:28:04 +11:00
|
|
|
endif ()
|
2017-01-18 21:43:30 +11:00
|
|
|
endif ()
|
|
|
|
|
2017-01-23 21:42:11 +11:00
|
|
|
link_libraries (${__nc_cxx_stdcxxfs})
|
2017-01-17 19:20:12 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
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")
|