`catch_discover_tests` pass `<target>_TESTS` variable to `PARENT_SCOPE`
Description
The following documentation is for the TEST_LIST option for catch_discover_tests from cmake-integration.md#customization (italics added):
Make the list of tests available in the variable var, rather than the default
<target>_TESTS. This can be useful when the same test executable is being used in multiple calls tocatch_discover_tests(). Note that this variable is only available in CTest.
I would like to be able to use this variable in CMake to register "dependencies" between tests. See this article by Craig Scott for more information
Additional context
The motivation for my usage of CMake's test fixture mechanism as described in Craig's article is that I have a library that has layers of abstraction that build upon each other, where tests for the the higher level abstractions are expensive to run, while the lower levels are comparatively much cheaper to run, so I want to test the lower layers first and short-circuit the rest of the higher layer tests if they fail. There are other good reasons to use CMake's test fixture feature. Mine is only one of them.
I have realized two things:
-
This probably wouldn't be as simple to implement as I naively thought. I thought it would be as simple as doing a
set(... PARENT_SCOPE), but the value ofTEST_LISTis generated by invoking cmake as a subprocess. -
I actually don't need this change. I can set up the FIXTURE properties in the call to
catch_discover_tests.
Sorry for the false alarm and thanks for your work on this project! Closing this issue now.