Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 1 | include(CheckLibraryExists) |
| 2 | include(CheckCXXCompilerFlag) |
| 3 | |
| 4 | # Check compiler flags |
| 5 | check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG) |
| 6 | check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG) |
| 7 | check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG) |
| 8 | check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG) |
| 9 | check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG) |
| 10 | check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG) |
| 11 | check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG) |
| 12 | check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG) |
| 13 | check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG) |
| 14 | check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG) |
| 15 | check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG) |
Alexey Samsonov | f7eb573 | 2013-10-02 07:44:19 +0000 | [diff] [blame] | 16 | check_cxx_compiler_flag(-Wno-error LIBCXX_HAS_WNO_ERROR_FLAG) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 17 | check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG) |
| 18 | check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG) |
| 19 | check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG) |
Alexey Samsonov | f7eb573 | 2013-10-02 07:44:19 +0000 | [diff] [blame] | 20 | check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 21 | check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG) |
| 22 | check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG) |
| 23 | check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG) |
| 24 | check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG) |
| 25 | |
| 26 | # Check libraries |
| 27 | check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) |
| 28 | check_library_exists(c printf "" LIBCXX_HAS_C_LIB) |
| 29 | check_library_exists(m ccos "" LIBCXX_HAS_M_LIB) |
Howard Hinnant | 20542c0 | 2011-05-24 12:54:00 +0000 | [diff] [blame] | 30 | check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB) |
Michael J. Spencer | 626916f | 2010-12-10 19:47:54 +0000 | [diff] [blame] | 31 | check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB) |
| 32 | |
| 33 | # Check C++0x features |
| 34 | if (LIBCXX_ENABLE_CXX0X) |
| 35 | if (LIBCXX_HAS_STDCXX0X_FLAG) |
| 36 | set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x) |
| 37 | endif() |
| 38 | else() |
| 39 | set(LIBCXX_HAS_STDCXX0X_FLAG FALSE) |
| 40 | endif() |