07.08.2017, 17:24, "Clément Gregoire" <lec...@gmail.com>: >> I usually stop reading Cmakelists.txt as soon as I see this >> >> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 >> -fprofile-arcs -ftest-coverage") >> >> 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. > > I don't have an issue with the flags per se, but with the usage of > set(CMAKE_CXX_FLAGS). Setting flags like that should be banned from modern > cmake scripts.
How can one set global compiler flags without use of CMAKE_CXX_FLAGS or setting flags for each individual target? > >> 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 >> >> No, you don't. It's entirely fine if you just run "make test" as I do in >> OSM2go. > From what I saw in the documentation of the script : > >> # Param _testrunner The name of the target which runs the tests > > It seems to call directly the command named _testrunner, which is somehow > confirmed from the cmakelists : > >> # src/CMakelists.txt >> add_executable(tests ${TEST_FILES}) >> >> # Linking up all libraries >> >> target_link_libraries(tests complex) >> >> add_test(NAME example_test COMMAND tests) >> # CMakelists.txt >> setup_target_for_coverage(${PROJECT_NAME}_coverage tests coverage) > From this I deduce that you need to call setup_target_for_coverage for each > different test executable. > > 2017-08-07 13:37 GMT+02:00 Rolf Eike Beer <e...@sf-mail.de>: >> Am 2017-08-07 11:06, schrieb Clément Gregoire: >> I usually stop reading Cmakelists.txt as soon as I see this >> >> set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 >> -fprofile-arcs -ftest-coverage") >> >> 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. >> >> 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 >> >> No, you don't. It's entirely fine if you just run "make test" as I do in >> OSM2go. >> >> Eike >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake > ,-- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Regards, Konstantin -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake