In my CMakeLists.txt I have something like this:
set_property(TEST testX APPEND PROPERTY DEPENDS testY)
set_property(TEST testX APPEND PROPERTY DEPENDS testZ)
And I want some way to run testX
and all its dependencies automatically.
Something like:
ctest <options> testX
and as a result, CTest will run textY
, testZ
and testX
.
Is there any way to do this?
Or, if it is impossible now, is there any way to extract information on the dependencies from the CMake build directory by script?
There's no built-in way of doing this as far as I know.
The best way I can think of to achieve your goal is to use the
LABELS
property on the tests. You can retrieve the list of dependencies usingget_property
orget_test_property
and apply the same label totestX
and each of its dependent tests:Then you can tell CTest to only run tests with that label: