<div dir="ltr">Hi, <br>I'm a bit stuck when trying to add coverage reports to Cmake (gcov +
 lcov) as I can't figure out what is the best (idiomatic) way to do it. <br>So far here are the ways I know of :<br>- setting the CMAKE_LANG_FLAGS based on a boolean + scan all files / run gcov on it : would like to avoid this<br>- same but adding a new build type : seems to be way better but running gcov would still be a pain<br>- same with a tool chain file for the flags : doesn't sound a good idea since coverage should only be ran in debug <br>- some library to link with that propagates the flags : not possible because link flags are not transient <br>-
 macro that adds the flags / does magic on a per target basis : many 
scripts do this but seems to be a pain to maintain. Also I would rather 
have all my test targets be set up automatically <br>- any of the above 
for flags and Ctest ctest_coverage but all I need are the gcov/lcov 
reports, not the coverage.xml for the dashboard <br>- using the command parameter of add_test<br>- something I missed? <br><br>I want the setup to be easy and compatible with <a rel="nofollow" target="_blank" href="http://codecov.io">codecov.io</a>, sadly all the script I found are bad, undocumented, or old and using bad practices. <br><br>Any help is welcome! <br><br>Thanks </div>