Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake and lcov: gcno files not found

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!!!

like image 611
Lars Bilke Avatar asked Jan 30 '12 17:01

Lars Bilke


1 Answers

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

like image 71
Lars Bilke Avatar answered Oct 23 '22 20:10

Lars Bilke