• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1include(CheckLibraryExists)
2include(CheckCXXCompilerFlag)
3
4# Check compiler flags
5check_cxx_compiler_flag(-std=c++0x            LIBCXX_HAS_STDCXX0X_FLAG)
6check_cxx_compiler_flag(-fPIC                 LIBCXX_HAS_FPIC_FLAG)
7check_cxx_compiler_flag(-nodefaultlibs        LIBCXX_HAS_NODEFAULTLIBS_FLAG)
8check_cxx_compiler_flag(-nostdinc++           LIBCXX_HAS_NOSTDINCXX_FLAG)
9check_cxx_compiler_flag(-Wall                 LIBCXX_HAS_WALL_FLAG)
10check_cxx_compiler_flag(-W                    LIBCXX_HAS_W_FLAG)
11check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
12check_cxx_compiler_flag(-Wwrite-strings       LIBCXX_HAS_WWRITE_STRINGS_FLAG)
13check_cxx_compiler_flag(-Wno-long-long        LIBCXX_HAS_WNO_LONG_LONG_FLAG)
14check_cxx_compiler_flag(-pedantic             LIBCXX_HAS_PEDANTIC_FLAG)
15check_cxx_compiler_flag(-Werror               LIBCXX_HAS_WERROR_FLAG)
16check_cxx_compiler_flag(-fno-exceptions       LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
17check_cxx_compiler_flag(-fno-rtti             LIBCXX_HAS_FNO_RTTI_FLAG)
18check_cxx_compiler_flag(/WX                   LIBCXX_HAS_WX_FLAG)
19check_cxx_compiler_flag(/EHsc                 LIBCXX_HAS_EHSC_FLAG)
20check_cxx_compiler_flag(/EHs-                 LIBCXX_HAS_NO_EHS_FLAG)
21check_cxx_compiler_flag(/EHa-                 LIBCXX_HAS_NO_EHA_FLAG)
22check_cxx_compiler_flag(/GR-                  LIBCXX_HAS_NO_GR_FLAG)
23
24# Check libraries
25check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
26check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
27check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
28check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
29check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
30
31# Check C++0x features
32if (LIBCXX_ENABLE_CXX0X)
33  if (LIBCXX_HAS_STDCXX0X_FLAG)
34    set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
35  endif()
36else()
37  set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
38endif()
39