CTestCoverageCollectGCOV: Update documentation

- Added missing arguments to the function signature
- Synced some minor formatting/RST nits
- Added simplified example
This commit is contained in:
Peter Kokot 2025-03-06 18:26:54 +01:00
parent c2d9b5944a
commit a76b533562
No known key found for this signature in database
GPG Key ID: A94800907AA79B36

View File

@ -7,10 +7,10 @@ CTestCoverageCollectGCOV
.. versionadded:: 3.2
This module provides the ``ctest_coverage_collect_gcov`` function.
This module provides the ``ctest_coverage_collect_gcov()`` function.
This function runs gcov on all .gcda files found in the binary tree
and packages the resulting .gcov files into a tar file.
This function runs ``gcov`` on all ``.gcda`` files found in the binary tree
and packages the resulting ``.gcov`` files into a tar file.
This tarball also contains the following:
* *data.json* defines the source and build directories for use by CDash.
@ -26,13 +26,19 @@ After generating this tar file, it can be sent to CDash for display with the
.. code-block:: cmake
ctest_coverage_collect_gcov(TARBALL <tarfile>
[SOURCE <source_dir>][BUILD <build_dir>]
ctest_coverage_collect_gcov(
TARBALL <tarfile>
[TARBALL_COMPRESSION <option>]
[SOURCE <source_dir>]
[BUILD <build_dir>]
[GCOV_COMMAND <gcov_command>]
[GCOV_OPTIONS <options>...]
)
[GLOB]
[DELETE]
[QUIET]
)
Run gcov and package a tar file for CDash. The options are:
Run ``gcov`` and package a tar file for CDash. The options are:
``TARBALL <tarfile>``
Specify the location of the ``.tar`` file to be created for later
@ -73,8 +79,9 @@ After generating this tar file, it can be sent to CDash for display with the
``GLOB``
.. versionadded:: 3.6
Recursively search for .gcda files in build_dir rather than
determining search locations by reading TargetDirectories.txt.
Recursively search for ``.gcda`` files in ``<build_dir>`` rather than
determining search locations by reading ``CMakeFiles/TargetDirectories.txt``
(file generated by CMake at the generation phase).
``DELETE``
.. versionadded:: 3.6
@ -88,6 +95,20 @@ After generating this tar file, it can be sent to CDash for display with the
.. versionadded:: 3.3
Added support for the :variable:`CTEST_CUSTOM_COVERAGE_EXCLUDE` variable.
Examples
^^^^^^^^
Generating code coverage data packaged as a ``.tar.gz`` file in a
:option:`ctest -S` script:
.. code-block:: cmake
include(CTestCoverageCollectGCOV)
ctest_coverage_collect_gcov(
TARBALL "${CTEST_BINARY_DIRECTORY}/gcov.tar.gz"
TARBALL_COMPRESSION "GZIP"
)
#]=======================================================================]
function(ctest_coverage_collect_gcov)