1
0

AppleClang-CXX.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. include(Compiler/Clang)
  2. __compiler_clang(CXX)
  3. if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
  4. set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
  5. endif()
  6. if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
  7. set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
  8. set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
  9. set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  10. set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
  11. endif()
  12. if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
  13. # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
  14. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  15. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  16. endif()
  17. set(CMAKE_CXX_STANDARD_DEFAULT 98)
  18. macro(cmake_record_cxx_compile_features)
  19. macro(_get_appleclang_features std_version list)
  20. record_compiler_features(CXX "${std_version}" ${list})
  21. endmacro()
  22. if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
  23. _get_appleclang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
  24. if (_result EQUAL 0)
  25. _get_appleclang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
  26. endif()
  27. if (_result EQUAL 0)
  28. _get_appleclang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
  29. endif()
  30. else()
  31. set(_result 0)
  32. endif()
  33. endmacro()