bilke / cmake-modules

Additional CMake functionality. Most of the modules are from Ryan Pavlik (https://github.com/rpavlik/cmake-modules)
Boost Software License 1.0
548 stars 213 forks source link

CodeCoverage: Some fixes/enhancements to output file handling #41

Closed ferdnyc closed 4 years ago

ferdnyc commented 4 years ago

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

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).