DirectoryScope.cmake 633 B

12345678910111213141516171819
  1. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Scripts")
  2. # Test include_guard with DIRECTORY scope
  3. # Add subdirectory which includes DirScript three times:
  4. # 1. Include at inner function scope
  5. # 2. At directory scope
  6. # 3. At another subdirectory to check that the guard is checked
  7. # against parent directories
  8. add_subdirectory(sub_dir_script1)
  9. # Add another directory which includes DirScript
  10. add_subdirectory(sub_dir_script2)
  11. # check inclusions count
  12. get_property(dir_count GLOBAL PROPERTY DIR_SCRIPT_COUNT)
  13. if(NOT dir_count EQUAL 2)
  14. message(FATAL_ERROR
  15. "Wrong DIR_SCRIPT_COUNT value: ${dir_count}, expected: 2")
  16. endif()