Get list of CMake test names

CMake add_test() can be dynamically set by arbitrarily complex foreach(), if(), etc. logic. A subset of tests can be configured dynamically after the tests are declared. A list of tests enabled is retrieved by the TESTS directory property. The variable “test_names” contains all the test names previously added in the CMakeLists.txt via “add_test()” in a list in the DIRECTORY scope.

get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)

set_property(TEST ${test_names} PROPERTY TIMEOUT 60)

get_property(test_names GLOBAL PROPERTY TESTS) will return an empty list–DIRECTORY scope must be used.