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.
Hi, I have a setup for doing something that you might be looking for. In the top-level CMakeLists.txt[1], I add some options to build with coverage. I also have a couple of macros[2] which make generating testing targets much nicer[3]. These macros do not assume CTest is enabled nor conflict with it. AFAIK they are gcov-specific, but another option could be added to use lcov instead. Similar with valgrind. If you have any questions or suggestions, feel free to ask. --Ben [1]http://git.benboeckel.net/?p=chasmd.git;a=blob;f=CMakeLists.txt [2]http://git.benboeckel.net/?p=chasmd.git;a=blob;f=cmake/test.cmake [3]http://git.benboeckel.net/?p=chasmd.git;a=blob;f=test/libchasm/CMakeLists.txt _______________________________________________ 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