CxxStandardGNU.cmake 740 B

123456789101112131415161718192021222324252627282930
  1. include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS})
  2. enable_language(CXX)
  3. try_compile(result ${try_compile_bindir_or_SOURCES}
  4. ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
  5. CXX_STANDARD 11
  6. CXX_STANDARD_REQUIRED 1
  7. CXX_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_CXX_STANDARD 11)
  15. set(CMAKE_CXX_STANDARD_REQUIRED 1)
  16. set(CMAKE_CXX_EXTENSIONS 0)
  17. try_compile(result ${try_compile_bindir_or_SOURCES}
  18. ${try_compile_redundant_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/CxxStandardGNU.cxx
  19. OUTPUT_VARIABLE out
  20. )
  21. if(NOT result)
  22. message(FATAL_ERROR "try_compile failed:\n${out}")
  23. endif()