Guideline for code coverage

Hello everyone,

After jumping around the some CMake documentation, Github sample project and Stackoverflow, I think it’s best to ask here

for correct usage of the CMake to get coverage report using GCov and Lcov. Any pointer (that not dangling) or advice is really

appreciated.

Thanks in advance

Adem.

Build with GCC and flags -fprofile-arcs -ftest-coverage. Then run ctest normally to run all the tests. Then run ctest -T Coverage to collect coverage results. The two ctest calls can be combined as ctest -T Test -T Coverage.

I’ve opened CMake Issue 19942 to propose the addition of a guide to the documentation.

2 Likes

I hope this issue to be resolved, thanks for the answer.