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
Post a Comment