Try adding these (with proper paths) to your CMakeLists.txt file: CMAKE_BUILD_TYPE:STRING=Debug COVERAGE_COMMAND:FILEPATH=/usr/bin/gcov CMAKE_C_FLAGS:STRING=-g -O0 -fprofile-arcs -ftest-coverage CMAKE_CXX_FLAGS:STRING=-g -O0 -fprofile-arcs -ftest-coverage
CTEST_MEMORYCHECK_COMMAND:FILEPATH=/usr/bin/valgrind) CTEST_MEMORYCHECK_COMMAND_OPTIONS:STRING=--trace-children=yes --quiet --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=100 --verbose --demangle=yes On Wed, Nov 3, 2010 at 9:11 AM, Gerhard Gappmeier <gerhard.gappme...@ascolab.com> wrote: > Hi all, > > I'm trying to figure out how to use gcov and maybe also lcov with cmake. > I know it works using ctest, I've seen that in several wiki entries, > but I could not find one single example on how to use it. > The wiki only shows the commandline args for GCC, but no cmake examples. > > I attached a simple hello world project with two tests (ADD_TEST) which work. > I tried to add the "ctest_coverage" and "ctest_memcheck" commands but I can't > get them working. > > Maybe somebody can complete this example. > > IMO a new section about gcov and valgrind should be added to > http://www.cmake.org/cmake/help/cmake_tutorial.html > This would help a lot of people. > > -- > mit freundlichen Grüßen / best regards > > *Gerhard Gappmeier* > ascolab GmbH - automation systems communication laboratory > Tel.: +49 9131 691 123 > Fax: +49 9131 691 128 > Web: http://www.ascolab.com > GPG Key Id: 5AAC50C4 > GPG Fingerprint: 967A 15F1 2788 164D CCA3 6C46 07CD 6F82 5AAC 50C4 > > -- > *ascolab GmbH* > Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe Steinkrauß > Sitz der Gesellschaft: Am Weichselgarten 7 . 91058 Erlangen . Germany > Registernummer: HRB 9360 > Registergericht: Amtsgericht Fürth > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake