How do I pass the timeout setting of CTest to test binaries?
You could use environment variables.
how is that number passed on to the test binary?
It is not, not that I know of.
Is there a CMake trick that inserts magic
I would just use an environment variable.
add_test(... COMMAND wrapper_script.sh the_executable args...)
and then in wrapper_script.sh
(or preferably similar code with a cmake script for portability, TODO):
#!/bin/sh
exec "$@" --the-timeout "${MY_TIMEOUT:-1500}"
and then when ctest
is run the timeout has to be set and exported to environment variables:
export MY_TIMEOUT=200 ; ctest --timeout "$MY_TIMEOUT" ...
With such design it could be simpler if the test executable itself would just read the environment variable MY_TIMEOUT
.