CMakeLists.txt 564 B

12345678910111213141516171819202122232425
  1. cmake_minimum_required(VERSION 3.10)
  2. if(POLICY CMP0129)
  3. cmake_policy(SET CMP0129 NEW)
  4. endif()
  5. project(add_compile_options)
  6. add_compile_options(-DTEST_OPTION)
  7. add_executable(add_compile_options main.cpp)
  8. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC")
  9. target_compile_definitions(add_compile_options
  10. PRIVATE
  11. "DO_GNU_TESTS"
  12. )
  13. endif()
  14. add_compile_options(-rtti)
  15. add_library(imp UNKNOWN IMPORTED)
  16. get_target_property(_res imp COMPILE_OPTIONS)
  17. if (_res)
  18. message(SEND_ERROR "add_compile_options populated the COMPILE_OPTIONS target property")
  19. endif()