CTEST_TEST_TIMEOUT
is for use within the CTest script, not a CMakeLists.txt
file. You can control the timeout in CMake for individual tests with the TIMEOUT
test property, but there isn't a CMake variable that sets the global timeout default. The following sets the timeout to 30 seconds for just the sometest
test:
add_test(sometest ...)
set_tests_properties(sometest PROPERTIES TIMEOUT 30)
You can, however, override the default timeout when you invoke ctest
using the --timeout
option. E.g. to run the tests with the global timeout default set to 120 seconds:
ctest --timeout 120
A timeout specified in CMake for an individual test still takes precedence over the globally set default timeout, even when the --timeout
option is used.