AppleClang-CXX.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
  10. set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  11. set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
  12. endif()
  13. if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  14. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
  15. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
  16. set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  17. elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
  18. # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
  19. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  20. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  21. set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  22. endif()
  23. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  24. set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
  25. set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
  26. endif()
  27. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
  28. set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
  29. endif()
  30. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
  31. set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
  32. set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
  33. endif()
  34. __compiler_check_default_language_standard(CXX 4.0 98)