Clang-C.cmake 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. include(Compiler/Clang)
  2. __compiler_clang(C)
  3. cmake_policy(GET CMP0025 appleClangPolicy)
  4. if(APPLE AND NOT appleClangPolicy STREQUAL NEW)
  5. return()
  6. endif()
  7. if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
  8. if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
  9. set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
  10. set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
  11. set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
  12. set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
  13. set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  14. set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
  15. set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
  16. set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  17. set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
  18. else()
  19. # clang-cl doesn't have any of these
  20. set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
  21. set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
  22. set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
  23. set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
  24. set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
  25. set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
  26. set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
  27. set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
  28. set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
  29. endif()
  30. endif()
  31. if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
  32. __compiler_check_default_language_standard(C 3.4 99 3.6 11)
  33. else()
  34. set(CMAKE_C_STANDARD_DEFAULT "")
  35. endif()