ctest - How to do code coverage in cmake -


i want use code coverage tools(lcov) in cmake project. read example here https://github.com/bilke/cmake-modules/blob/master/codecoverage.cmake tests added in project using 'add_test()' cmake function.

i want create custom target, called 'test_coverage', when invoked execution should run tests, collect coverage data , generate html(using genhtml) in directory 'code_coverage'.

is there way list of tests in project , directory paths, in custom target 'test_coverage' execute each test individually , collect coverage data ?

you can either execute 'ctest -vv' command line, , if tests created using add_test, execute.

if want custom build target same, can use code:

add_custom_target(run_tests    command "ctest -vv" ) 

i have lot of cmake code code coverage , unit testing show, doesn't make sense copy/paste here yet since sounds you're getting started.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -