TEST_INCLUDE_FILES.rst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. TEST_INCLUDE_FILES
  2. ------------------
  3. .. versionadded:: 3.10
  4. This directory property specifies a list of CMake scripts to be included and
  5. processed when ``ctest`` runs on the directory. Use absolute paths, to avoid
  6. ambiguity. Script files are included in the specified order.
  7. ``TEST_INCLUDE_FILES`` scripts are processed when running ``ctest``, not during
  8. the ``cmake`` configuration phase. These scripts should be written as if they
  9. were CTest dashboard scripts. It is common to generate such scripts dynamically
  10. since many variables and commands available during configuration are not
  11. accessible at test phase.
  12. Examples
  13. ^^^^^^^^
  14. Setting this directory property to append one or more CMake scripts:
  15. .. code-block:: cmake
  16. :caption: CMakeLists.txt
  17. configure_file(script.cmake.in script.cmake)
  18. set_property(
  19. DIRECTORY
  20. APPEND
  21. PROPERTY TEST_INCLUDE_FILES
  22. ${CMAKE_CURRENT_BINARY_DIR}/script.cmake
  23. ${CMAKE_CURRENT_SOURCE_DIR}/foo.cmake
  24. ${dir}/bar.cmake
  25. )
  26. .. code-block:: cmake
  27. :caption: script.cmake.in
  28. execute_process(
  29. COMMAND "@CMAKE_COMMAND@" -E echo "script.cmake executed during CTest"
  30. )