This is a follow-up to #39, and makes some alterations to output file naming (for lcov), as well as to the handling of files produced by the coverage target.
Renamed lcov stage files
The filenames generated by the four stages of the lcov target collection process have been rearranged to more clearly indicate their purpose.
Processing stage
Old filename
New filename
Collect baseline counters
${Coverage_NAME}.base
(same)
Capture coverage data
${Coverage_NAME}.info
${Coverage_NAME}.capture
Combine baseline + captured data
${Coverage_NAME}.total
(same)
Process .total file to remove excluded files
${Coverage_NAME}.info.cleaned
${Coverage_NAME}.info
These changes better reflect the nature of the various files produced at each stage, and denote the (former) .info.cleaned file as the final output (the "canonical" .info file), as it contains the fully-processed data from which the HTML report will subsequently be generated.
CMake-driven file cleanup
Since CMake 3.13, the Makefile generator will remove any BYPRODUCTS of custom commands when make clean is run in the build directory. These changes make use of that functionality, rather than performing manual "housekeeping".
The ADDITIONAL_MAKE_CLEAN_FILES directory property is no longer set by the targets.
All files/directories produced by coverage runs (data files as well as generated reports) are added to the BYPRODUCTS of the targets created by the setup_target_for_coverage_*() functions.
The BYPRODUCTS argument to the target created by setup_target_for_coverage_gcovr_xml() is now correctly passed the name of the only file generated by that target, ${Coverage_NAME}.xml.
Note: The use of BYPRODUCTS to populate the output file list means that CMake versions < 3.13 will not clean up any of the output files produced, even when running make clean. However, leaving the files in place is still preferable to arbitrarily removing files without the user's knowledge, and they always have the option of deleting them manually (or by adding their own removal commands in the calling CMakeLists.txt).
This is a follow-up to #39, and makes some alterations to output file naming (for lcov), as well as to the handling of files produced by the coverage target.
Renamed
lcov
stage filesThe filenames generated by the four stages of the
lcov
target collection process have been rearranged to more clearly indicate their purpose.${Coverage_NAME}.base
${Coverage_NAME}.info
${Coverage_NAME}.capture
${Coverage_NAME}.total
.total
file to remove excluded files${Coverage_NAME}.info.cleaned
${Coverage_NAME}.info
These changes better reflect the nature of the various files produced at each stage, and denote the (former)
.info.cleaned
file as the final output (the "canonical".info
file), as it contains the fully-processed data from which the HTML report will subsequently be generated.CMake-driven file cleanup
Since CMake 3.13, the Makefile generator will remove any
BYPRODUCTS
of custom commands whenmake clean
is run in the build directory. These changes make use of that functionality, rather than performing manual "housekeeping".ADDITIONAL_MAKE_CLEAN_FILES
directory property is no longer set by the targets.BYPRODUCTS
of the targets created by thesetup_target_for_coverage_*()
functions.lcov
target no longer automatically deletes intermediate files, all generated files will be left in place for the caller to make use of if needed. (Suggested in https://github.com/bilke/cmake-modules/pull/39#issuecomment-566087474.)The
BYPRODUCTS
argument to the target created bysetup_target_for_coverage_gcovr_xml()
is now correctly passed the name of the only file generated by that target,${Coverage_NAME}.xml
.Note: The use of
BYPRODUCTS
to populate the output file list means that CMake versions < 3.13 will not clean up any of the output files produced, even when runningmake clean
. However, leaving the files in place is still preferable to arbitrarily removing files without the user's knowledge, and they always have the option of deleting them manually (or by adding their own removal commands in the callingCMakeLists.txt
).