Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeCoverage.cmake - difficulties using it to cover shared libraries rather than the main program #53

Open
jmp75 opened this issue Jul 11, 2020 · 1 comment

Comments

@jmp75
Copy link

jmp75 commented Jul 11, 2020

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.

@wuzhuobin
Copy link

i encounter same problems the BASE_DIRECTORY is not working expectedly.
I think the problem is the L212
the if(${Coverage_BASE_DIRECTORY}) should be changed to if(Coverage_BASE_DIRECTORY)
Same as L310 and L382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants