AppleClang-CXX.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. include(Compiler/Clang)
  2. __compiler_clang(CXX)
  3. set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
  4. if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
  5. if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
  6. AND CMAKE_GENERATOR MATCHES "Makefiles"
  7. AND CMAKE_DEPFILE_FLAGS_CXX)
  8. # dependencies are computed by the compiler itself
  9. set(CMAKE_CXX_DEPFILE_FORMAT gcc)
  10. set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE)
  11. endif()
  12. set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
  13. endif()
  14. if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
  15. set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
  16. set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
  17. set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
  18. set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  19. set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
  20. endif()
  21. if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  22. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
  23. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
  24. set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  25. elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
  26. # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
  27. set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
  28. set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
  29. set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
  30. endif()
  31. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
  32. set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
  33. set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
  34. elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
  35. set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
  36. set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
  37. endif()
  38. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
  39. set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
  40. endif()
  41. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
  42. set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
  43. set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
  44. endif()
  45. __compiler_check_default_language_standard(CXX 4.0 98)