Support system tests with pseudo CMake targets
The CMake function
dune_add_system_tests requires either
SOURCE as arguments (by the way, this is not documented in the function docstring), meaning that either an existing target is used for the test or the function creates one or multiple new targets from the specified sources. The respective target is then passed to the Python wrapper script as
--exec argument. MR !124 (merged) now imposes new restrictions on the
TARGET: It must have a
TARGET_FILE, or some sort of location. A target defined by
INTERFACE libraries do not have this property.
Our use case
In DORiE, we compile multiple executable targets and combine them via a custom target
dorie, such that the command
make dorie compiles all of them. We use a Python wrapper for executing the proper executable and running the tests based on the configuration files it receives. Before the !124 (merged) "bugfix", we could use the
dorie pseudo target as argument to
dune_add_system_tests. Its name was used as basename for the tests and passed via the
--exec argument to our wrapper which never evaluated it. This is now not possible anymore. Instead, we have to define a dummy target with an arbitrary location to make sure CMake can query
Custom Python wrapper scripts handed over to
dune_add_system_tests via the
SCRIPT variable might not require a target location for executing the test. Therefore:
- Make the
TARGETvariable optional if a custom
SCRIPTis passed to the function.
TARGETis not defined, do not pass an
--execargument to the script.
TARGETis not defined, require a
BASENAMEargument for naming the tests.