<div dir="ltr"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I usually stop reading Cmakelists.txt as soon as I see this</blockquote></span><br><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote></span><br><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0</blockquote></span><br><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-fprofile-arcs -ftest-coverage")</blockquote></span><br><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote>
</span><br><span class="gmail-im"></span>
The pthread thing there is likely wrong anyway, and the -Wall is 
entirely optional. The other things are needed, otherwise gcov will not 
produce any useful output.<br></blockquote><br><br></div>I don't have an issue with the flags per se, but with the usage of <span class="gmail-im">set(CMAKE_CXX_FLAGS). Setting flags like that should be banned from modern cmake scripts.<br><br></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-im"><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Also you need to use the SETUP_TARGET_FOR_COVERAGE for every single test</blockquote></span></span><br><span class="gmail-im"><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
target, which seems to be a difficult to scale on big projects</blockquote></span></span><br><span class="gmail-im"><span class="gmail-im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote>
</span></span><br><span class="gmail-im"><span class="gmail-im"></span>
No, you don't. It's entirely fine if you just run "make test" as I do in OSM2go.</span><br><span class="gmail-im"></span></blockquote><span class="gmail-im"><br></span></div><span class="gmail-im">From what I saw in the documentation of the script :<br><br></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-pl-c"><span class="gmail-pl-c">#</span> Param _testrunner     The name of the target which runs the tests</span></blockquote><div><span class="gmail-im"><br></span></div><div><span class="gmail-im">It seems to call directly the command named _testrunner, which is somehow confirmed from the cmakelists :<br><br></span><br><blockquote><div><br><span class="gmail-im"><span class="gmail-pl-c1"># src/CMakelists.txt<br>add_executable</span>(tests <span class="gmail-pl-smi">${TEST_FILES}</span>)
      
      
        </span><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC11" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c"><span class="gmail-pl-c">#</span> Linking up all libraries</span></td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC12" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line"><span class="gmail-pl-c1">target_link_libraries</span>(tests complex)</td>
      </tr>
      <tr>
        </tr></tbody></table><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container"><tbody><tr><td id="gmail-LC13" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line">
<br></td>
      </tr>
      <tr>
        </tr></tbody></table><span class="gmail-pl-c1">add_test</span>(<span class="gmail-pl-k">NAME</span> example_test <span class="gmail-pl-k">COMMAND</span> tests)<br></div># CMakelists.txt<br>setup_target_for_coverage(<span class="gmail-pl-smi">${PROJECT_NAME}</span>_coverage tests coverage)<span class="gmail-im"></span><br><div><span class="gmail-im"></span></div></blockquote><span class="gmail-im"><br></span></div><div><span class="gmail-im">From this I deduce that you need to call </span>setup_target_for_coverage for each different test executable.<br></div><div><span class="gmail-im"><br><br></span><span class="gmail-im"></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-07 13:37 GMT+02:00 Rolf Eike Beer <span dir="ltr"><<a href="mailto:eike@sf-mail.de" target="_blank">eike@sf-mail.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Am 2017-08-07 11:06, schrieb ClĂ©ment Gregoire:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I usually stop reading Cmakelists.txt as soon as I see this<br>
<br>
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0<br>
-fprofile-arcs -ftest-coverage")<br>
</blockquote>
<br></span>
The pthread thing there is likely wrong anyway, and the -Wall is entirely optional. The other things are needed, otherwise gcov will not produce any useful output.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also you need to use the SETUP_TARGET_FOR_COVERAGE for every single test<br>
target, which seems to be a difficult to scale on big projects<br>
</blockquote>
<br></span>
No, you don't. It's entirely fine if you just run "make test" as I do in OSM2go.<div class="HOEnZb"><div class="h5"><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/CMak<wbr>e_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/su<wbr>pport.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/co<wbr>nsulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/tr<wbr>aining.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/opensou<wbr>rce/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/mail<wbr>man/listinfo/cmake</a></div></div></blockquote></div><br></div>