cmake-modules
cmake-modules copied to clipboard
CodeCoverage.cmake - difficulties using it to cover shared libraries rather than the main program
Using this version of CodeCoverage.cmake.
I wanted to use CodeCoverage.cmake to extract test coverage information in a context where I have a main test executable but want coverage for a shared library it links against.
The functions setup_target_for_coverage_gcovr_blah
have an argument BASE_DIRECTORY
but whether trying to use relative paths or absolute paths I just could not get it to work as expected. There is/was a bug such that only the main executable can end up in the code coverage report. Even with that fixed, base_directory
appears to be relative the cmake build directory rather than the calling cmakelists.txt.
I've implemented something that works with BASE_DIRECTORY
relative to the directory of the calling CMakeLists.txt
file. The provisional changes are in this commit
I may submit a PR but I am not sure this is the intended behavior. Also it intersects with the pending pull request 51 related to issue #50 and will try to include these changes before a PR.