简体   繁体   中英

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

我已经弄明白了如何将lcov与CMake一起使用并将所有内容捆绑在一个cmake模块中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM