diff options
| author | Holger Kaelberer | 2023-04-11 09:50:16 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-04-19 23:51:42 +0200 |
| commit | aad926baf87bb0121afc07b100e61f2b344ce156 (patch) | |
| tree | 23f23ad8b7466b3214adea314e29732fe7c9da02 /docs | |
| parent | 4e8399d83532cc8f990caa3937319c3f8f92e8b8 (diff) | |
| download | catch3-aad926baf87bb0121afc07b100e61f2b344ce156.tar.gz | |
Catch.cmake: Add new DISCOVERY_MODE option to catch_discover_tests
Introducing a new DISCOVERY_MODE mode option, which provides greater
control over when catch_discover_tests perforsm test discovery.
It has two supported modes:
* POST_BUILD: The default behavior, which adds a POST_BUILD command
to perform test discovery after the test has been built as was
always done so far.
* PRE_TEST: New mode, which delays test discovery until test execution.
The generated include file generates the appropriate CTest files at
runtime and regenerates the CTest files when the executable is
updated.
This mode can be used in build-environments that don't allow for
executing the linked binaries at build-time (like in a
cross-compilation environment).
DISCOVERY_MODE can be controlled in two ways:
1. Setting the DISCOVERY_MODE when calling catch_discover_tests.
2. Setting the global CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE prior
to calling gtest_discover_tests.
Closes #2493
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cmake-integration.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/cmake-integration.md b/docs/cmake-integration.md index 0720a95b..e38d5c2f 100644 --- a/docs/cmake-integration.md +++ b/docs/cmake-integration.md @@ -126,6 +126,7 @@ catch_discover_tests(target [OUTPUT_DIR dir] [OUTPUT_PREFIX prefix] [OUTPUT_SUFFIX suffix] + [DISCOVERY_MODE <POST_BUILD|PRE_TEST>] ) ``` @@ -198,6 +199,16 @@ If specified, `suffix` is added to each output file name, like so `--out dir/<test_name>suffix`. This can be used to add a file extension to the output file name e.g. ".xml". +* `DISCOVERY_MODE mode` + +If specified allows control over when test discovery is performed. +For a value of `POST_BUILD` (default) test discovery is performed at build time. +For a a value of `PRE_TEST` test discovery is delayed until just prior to test +execution (useful e.g. in cross-compilation environments). +``DISCOVERY_MODE`` defaults to the value of the +``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when +calling ``catch_discover_tests``. This provides a mechanism for globally +selecting a preferred test discovery behavior. ### `ParseAndAddCatchTests.cmake` |