CStandardGNU.cmake 718 B

123456789101112131415161718192021222324252627282930
  1. include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
  2. enable_language(C)
  3. try_compile(result ${try_compile_bindir_or_SOURCES}
  4. ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
  5. C_STANDARD 99
  6. C_STANDARD_REQUIRED 1
  7. C_EXTENSIONS 0
  8. OUTPUT_VARIABLE out
  9. )
  10. if(NOT result)
  11. message(FATAL_ERROR "try_compile failed:\n${out}")
  12. endif()
  13. cmake_policy(SET CMP0067 NEW)
  14. set(CMAKE_C_STANDARD 99)
  15. set(CMAKE_C_STANDARD_REQUIRED 1)
  16. set(CMAKE_C_EXTENSIONS 0)
  17. try_compile(result ${try_compile_bindir_or_SOURCES}
  18. ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CStandardGNU.c
  19. OUTPUT_VARIABLE out
  20. )
  21. if(NOT result)
  22. message(FATAL_ERROR "try_compile failed:\n${out}")
  23. endif()