Help: Document GTest discovery mode default variable

This commit is contained in:
Tyler Yankee committed 2026-10-12 12:38:44 -04:00
1 parent de5840724d
commit 3e4b7dbaa8
2 files changed
+16 -2

No files matched your search

+1 -1
View File
@@ -195,7 +195,7 @@ Modules
* gained a new ``DISCOVERY_MODE`` option to control when the test
discovery step is run. It offers a new ``PRE_TEST`` setting to
run the discovery at test time instead of build time. A new
``CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE`` variable can be used
:variable:`CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE` variable can be used
to change the default globally.
* gained a new optional parameter ``XML_OUTPUT_DIR``. When set the
+15 -1
View File
@@ -42,6 +42,9 @@ usually considered as more beneficial. By default, the CTest test name is the
same as the Google Test name (i.e. ``suite.testcase``); see also
``TEST_PREFIX`` and ``TEST_SUFFIX``.
Commands
^^^^^^^^
.. command:: gtest_add_tests
Automatically add tests with CTest by scanning source code for Google Test
@@ -314,7 +317,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
dependencies.
``DISCOVERY_MODE`` defaults to the value of the
``CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not
:variable:`CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE` variable if it is not
passed when calling ``gtest_discover_tests()``. This provides a mechanism
for globally selecting a preferred test discovery behavior without having
to modify each call site.
@@ -333,6 +336,17 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
:prop_tgt:`CROSSCOMPILING_EMULATOR` target properties are preserved,
see policy :policy:`CMP0178`.
Variables
^^^^^^^^^
.. variable:: CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE
.. versionadded:: 3.18
Default value for the ``DISCOVERY_MODE`` option of
:command:`gtest_discover_tests`. The value must be one of ``POST_BUILD``
or ``PRE_TEST``. If this variable is not set, ``POST_BUILD`` is used.
#]=======================================================================]
# Save project's policies