manipulating tests that are defined in a subdir

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

manipulating tests that are defined in a subdir

Paul Seyfert
Dear all,
(essentially asking what I already posted on SO

I have a my_project/CMakeLists.txt file under my control. In its directory there is also a git submodule (say 'my_project/sub' for now), and I add the git-submodule on the cmake level though add_subdirectory(sub). The submodule is not under my control (well, I can fork it of cause, but we'd prefer not to have diverging branches, and the other way around, we don't want to pollute the submodule with my-project specific stuff).
Because of my (admittedly strange) production platform, the tests from sub fail in my project.

I can fix that by changing properties of the tests with `set_tests_properties(test_in_sub PROPERTIES ...)`.

However since the tests are defined in my_project/sub/CMakeLists.txt and I don't want to have my_project specific bodges in sub, I would like to call set_tests_properties from my_project/CMakeLists.txt.

When trying to do so, cmake reports that the test I'm trying to manipulate wouldn't exist. Things work when I call `add_test` and `set_tests_properties` from the same CMakeLists.txt file.

My question thus is: Is it possible to call `set_tests_properties` for a test that is `add_test`ed in a different CMakeLists.txt file, and if so how? (Well, and if not, I'm happy for other suggestions)

Thanks in advance,


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: