<p dir="ltr">I usually stop reading Cmakelists.txt as soon as I see this</p>
<p dir="ltr">set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage")</p>
<p dir="ltr">Also you need to use the SETUP_TARGET_FOR_COVERAGE for every single test target, which seems to be a difficult to scale on big projects </p>
<br><div class="gmail_quote"><div dir="ltr">Le lun. 7 août 2017 à 12:50, Rolf Eike Beer <<a href="mailto:eike@sf-mail.de">eike@sf-mail.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 2017-08-07 09:57, schrieb Clément Gregoire:<br>
> Hi,<br>
> I'm a bit stuck when trying to add coverage reports to Cmake (gcov +<br>
> lcov)<br>
> 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 /<br>
> run<br>
> gcov on it : would like to avoid this<br>
> - same but adding a new build type : seems to be way better but running<br>
> gcov would still be a pain<br>
> - same with a tool chain file for the flags : doesn't sound a good idea<br>
> since coverage should only be ran in debug<br>
> - some library to link with that propagates the flags : not possible<br>
> because link flags are not transient<br>
> - macro that adds the flags / does magic on a per target basis : many<br>
> scripts do this but seems to be a pain to maintain. Also I would rather<br>
> have all my test targets be set up automatically<br>
> - any of the above for flags and Ctest ctest_coverage but all I need<br>
> are<br>
> 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 href="http://codecov.io" rel="noreferrer" target="_blank">codecov.io</a>, sadly all<br>
> the<br>
> script I found are bad, undocumented, or old and using bad practices.<br>
<br>
What's wrong with this one:<br>
<a href="https://github.com/codecov/example-cpp11-cmake" rel="noreferrer" target="_blank">https://github.com/codecov/example-cpp11-cmake</a> ?<br>
<br>
I use it for both Codecov.io and CDash at the same time, see<br>
<a href="https://github.com/osm2go/osm2go/blob/master/.travis.yml" rel="noreferrer" target="_blank">https://github.com/osm2go/osm2go/blob/master/.travis.yml</a><br>
<br>
Eike<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></blockquote></div>