The catch_discover_tests CMake command that comes with Catch2 uses the TEST_INCLUDE_FILES command to run custom code when ctest runs. Calling get_test_property in one of the TEST_INCLUDE_FILES fails with the error:
Oh. I see now. You’re using ctest. The set of commands available in CTest scripts is not the same. This is one such command that is not available there.
Test project /Users/eric/IdeaProjects/experiments-c/cmake-build-debug
CMake Error at /Users/eric/IdeaProjects/experiments-c/cmake-build-debug/catch_example_tests-b858cb2.cmake:9 (set_property):
set_property given TEST names that do not exist:
Testing
Call Stack (most recent call first):
/Users/eric/IdeaProjects/experiments-c/cmake-build-debug/catch_example_include-b858cb2.cmake:2 (include)
CTestTestfile.cmake:7 (include)
get_property(TEST test APPEND PROPERTY LABELS var) also fails in TEST_INCLUDE_FILES.
Hrm, yeah, I don’t see it documented anywhere . Let’s open an issue to get it documented.
@kyle.edwards You might know more since, IIRC, you added the “what commands are available where?” mechanisms to the code, but maybe that was just for CMake.
I stumbled on the exact same problem. Until I noticed that apparently ctest only supports “Scripting Commands” (as what Craig Scott said in the issue).
In my case I wanted to know the WORKING_DIR from a gtest_discover_tests to support Ninja Multi-Config