AppleClang-C.cmake 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. include(Compiler/Clang)
  2. __compiler_clang(C)
  3. if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
  4. set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
  5. set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
  6. set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
  7. set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
  8. set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
  9. set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
  10. endif()
  11. if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
  12. set(CMAKE_C_STANDARD_DEFAULT 99)
  13. endif()
  14. macro(cmake_record_c_compile_features)
  15. macro(_get_appleclang_features std_version list)
  16. record_compiler_features(C "${std_version}" ${list})
  17. endmacro()
  18. set(_result 0)
  19. if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
  20. _get_appleclang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
  21. if (_result EQUAL 0)
  22. _get_appleclang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
  23. endif()
  24. if (_result EQUAL 0)
  25. _get_appleclang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
  26. endif()
  27. endif()
  28. endmacro()