How to overwrite Ctest default timeout 1500 in CMakeLists.txt
CTEST_TEST_TIMEOUT
is intended to be used in a CTest script file, not a file CMakeLists.txt
. You can control the timeout in CMake for individual tests with a property TIMEOUT
, but there is no CMake variable that sets the global default. The following sets the timeout to 30 seconds just for the test sometest
:
add_test(sometest ...) set_tests_properties(sometest PROPERTIES TIMEOUT 30)
However, you can override the default timeout when called ctest
using a parameter --timeout
. For example. to run tests with a default global timeout of 120 seconds:
ctest --timeout 120
The timeout specified in CMake for an individual test still takes precedence over the globally set default timeout, even if the option is used --timeout
.
source to share