Question

I am trying to get code coverage on my CMake based project (which consists of several targets).

First I generate gcno files with:

lcov -b . -d . -o coverage.output --capture --initial

The *.gcno are generated in

build_dir/[target_dir]/CMakeFiles/[target_dir].dir

Then I run my tests which generate *.gcna files in

build_dir/tests/CMakeFiles/[target_dir].dir

When I now run lcov again:

lcov -b . -d . -o coverage.output --capture

I get the following error:

Scanning . for .gcda files ...
Found 23 data files in .
Processing Base.dir/DateTools.cpp.gcda
geninfo: ERROR: build_gcov/tests/CMakeFiles/Base.dir/DateTools.cpp.gcno: could not open file

When I manually move the *.gcno file to the directory where the *.gcda is generated it seems to work.

Thanks for your help!!!

Was it helpful?

Solution

I have figured it out how to use lcov with CMake and bundled everything in a cmake module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top