AdamNiederer / cov

An emacs extension for displaying coverage data on your code
GNU General Public License v3.0
76 stars 16 forks source link

gcov: add support for CMake-based projects #52

Closed abougouffa closed 1 year ago

abougouffa commented 1 year ago

For CMake projects, the .gcov files aren't stored beside the source file, instead, they are placed next to the generated object files (in CMake projects, it will be somewhere like path/to/build/dir/CMakeFiles/target.src/path/to/file/file.cpp.gcov)

Also, as CMake generates object files as file.cpp.o instead of file.o, gcov generates a file based on that file.cpp.gcov and not file.gcov.

I've added a function which leverages the information included in the compile_commands.json, it extracts the build directory and build command for the file, and then constructs the path to the .gcov file which will be next to the .o file.