cmake/nc_cxx.cmake
Danny Robson 874bbb2413 cxx: remove test for the filesystem library
We no longer use compilers that rely on this library, and the 'null'
case in library detection was broken.
2019-05-05 09:17:49 +10:00

51 lines
1.6 KiB
CMake

###############################################################################
if (__nc_cxx)
return ()
endif ()
set (__nc_cxx TRUE)
###############################################################################
# clear the default flags because they include optimisation flags we
# explicitly do not want (ie, O3).
set (CMAKE_CXX_FLAGS_RELEASE "")
set (CMAKE_C_FLAGS_RELEASE "")
set (CMAKE_CXX_FLAGS_DEBUG "")
set (CMAKE_C_FLAGS_DEBUG "")
###############################################################################
include (compile_flag)
include (test_restrict)
###############################################################################
append_compile_flag ("-fcolor-diagnostics")
###############################################################################
append_compile_flag ("-std=c++2a")
append_compile_flag ("-fpermissive")
append_compile_flag ("/std:c++latest")
# try to use clangs libc++ under the assumption that gcc will fail this test
# and clang will pass (if it is present). this is necessary because some
# libstdc++ headers don't behave well under c++17/clang.
append_compile_flag ("-stdlib=libc++")
###############################################################################
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")
append_compile_flag("-fPIC")
append_compile_flag("-D__STDC_FORMAT_MACROS")
add_definitions("-D_FILE_OFFSET_BITS=64")