You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.3 KiB

  1. set(CMake_CXX14_CSTDIO_BROKEN 0)
  2. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND CMAKE_CXX14_STANDARD_COMPILE_OPTION)
  3. if(NOT DEFINED CMake_CXX14_CSTDIO_WORKS)
  4. message(STATUS "Checking if compiler supports C++14 cstdio")
  5. try_compile(CMake_CXX14_CSTDIO_WORKS
  6. ${CMAKE_CURRENT_BINARY_DIR}
  7. ${CMAKE_CURRENT_LIST_DIR}/cm_cxx14_cstdio.cpp
  8. CMAKE_FLAGS -DCMAKE_CXX_STANDARD=14
  9. OUTPUT_VARIABLE OUTPUT
  10. )
  11. if(CMake_CXX14_CSTDIO_WORKS AND "${OUTPUT}" MATCHES "error: no member named.*gets.*in the global namespace")
  12. set_property(CACHE CMake_CXX14_CSTDIO_WORKS PROPERTY VALUE 0)
  13. endif()
  14. if(CMake_CXX14_CSTDIO_WORKS)
  15. message(STATUS "Checking if compiler supports C++14 cstdio - yes")
  16. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
  17. "Determining if compiler supports C++14 cstdio passed with the following output:\n"
  18. "${OUTPUT}\n"
  19. "\n"
  20. )
  21. else()
  22. message(STATUS "Checking if compiler supports C++14 cstdio - no")
  23. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
  24. "Determining if compiler supports C++14 cstdio failed with the following output:\n"
  25. "${OUTPUT}\n"
  26. "\n"
  27. )
  28. endif()
  29. endif()
  30. if(NOT CMake_CXX14_CSTDIO_WORKS)
  31. set(CMake_CXX14_CSTDIO_BROKEN 1)
  32. endif()
  33. endif()