CMakeLists.txt 908 B

12345678910111213141516171819202122232425262728
  1. cmake_minimum_required(VERSION 2.8.12)
  2. cmake_policy(SET CMP0025 NEW)
  3. project(CxxDialect)
  4. add_executable(use_typeof use_typeof.cxx)
  5. set_property(TARGET use_typeof PROPERTY CXX_STANDARD 98)
  6. add_executable(use_constexpr use_constexpr.cxx)
  7. set_property(TARGET use_constexpr PROPERTY CXX_STANDARD 11)
  8. add_executable(CxxDialect use_constexpr_and_typeof.cxx)
  9. set_property(TARGET CxxDialect PROPERTY CXX_STANDARD 11)
  10. try_compile(typeof_no_extensions_works
  11. "${CMAKE_CURRENT_BINARY_DIR}/use_typeof_test"
  12. "${CMAKE_CURRENT_SOURCE_DIR}/use_typeof.cxx"
  13. COMPILE_DEFINITIONS
  14. CMAKE_FLAGS
  15. "-DCMAKE_CXX_STANDARD=98"
  16. "-DCMAKE_CXX_EXTENSIONS=FALSE"
  17. OUTPUT_VARIABLE OUTPUT
  18. )
  19. if (typeof_no_extensions_works)
  20. message("Use of typeof extension with extensions disabled works, but is expected to fail: ${OUTPUT}")
  21. else()
  22. message("Use of typeof extension with extensions disabled fails, as expected")
  23. endif()