How to do code coverage in cmake

28k views Asked by At

I want to use code coverage tools(lcov) in my cmake project. I read the example here https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake The tests are added in my project using the 'add_test()' cmake function.

I want to create a custom target, something called 'test_coverage', that when invoked for execution should run all the tests, collect their coverage data and generate the html(using genhtml) in a directory 'code_coverage'.

Is there a way I could get the list of all the tests in my project and their directory paths, so that in the custom target 'test_coverage' I could execute each test individually and collect its coverage data ?

0

There are 0 answers