Well, I've had mixed results trying this myself. With the trivial SmallAndFast project, I get a good coverage measurement on 5 lines of code in 1 source file: http://my.cdash.org/viewCoverage.php?buildid=313323&status=3
With CMake itself, I get a bunch of *.gcda files generated in the build tree, but the coverage info does not get communicated properly via a ctest script sending to CDash. Looks like there's some issue with ctest parsing of the gcov output using ctest 2.8.7 and clang on the Mac and gcov 4.2.1: $ gcov --version gcov (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) Looks like there's a problem somebody will have to fix before it will work. Unfortunately, the gcov parsing code in ctest is a bit of a tangle -- last time I was in there, I fixed some stuff up to work in a MinGW environment, and it's not pretty. Also unfortunately, I don't think I'll have the bandwidth to look at this myself in the near future: anybody want to volunteer to take a look and submit a patch to get this working...? Thx, David On Sat, Mar 24, 2012 at 8:53 AM, David Cole <david.c...@kitware.com> wrote: > The answer to that stackoverflow question recommends using > clang/clang++ instead. (I have not tried this yet myself, but would > not be entirely surprised to find out it's correct. I have observed > the zero coverage phenomenon on my own Mac laptop, but have sufficient > coverage capabilities elsewhere... so I didn't care enough to follow > up on it previously.) > > > HTH, > David > > > > On Sat, Mar 24, 2012 at 8:51 AM, David Cole <david.c...@kitware.com> wrote: >> Perhaps it's because of this problem with the Mac "gcc" which is not >> *really* just gcc anymore, and apparently doesn't support gcov >> transparently as it should... >> >> http://stackoverflow.com/questions/7988355/getting-0-gcov-coverage-for-a-mac-app >> >> >> On Sat, Mar 24, 2012 at 7:45 AM, <noru...@me.com> wrote: >>> Hello, >>> >>> I have the following code in the main CTestScript.cmake which I call with >>> "ctest -S CTestScript.cmake, Continuous": >>> >>> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall -W >>> -Wunused-variable -Wunused-parameter -Wunused-function -Wunused >>> -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings >>> -fprofile-arcs -ftest-coverage") >>> SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -Wall -W -fprofile-arcs >>> -ftest-coverage") >>> SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs >>> -ftest-coverage") >>> SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} >>> -fprofile-arcs -ftest-coverage") >>> SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} >>> -fprofile-arcs -ftest-coverage") >>> >>> FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" " >>> CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ >>> CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ >>> CMAKE_EXE_LINKER_FLAGS:STRING=@CMAKE_EXE_LINKER_FLAGS@ >>> CMAKE_MODULE_LINKER_FLAGS:STRING=@CMAKE_MODULE_LINKER_FLAGS@ >>> CMAKE_SHARED_LINKER_FLAGS:STRING=@CMAKE_SHARED_LINKER_FLAGS@ >>> ") >>> >>> >>> ## -- Configure >>> message (" -- Configure ${MODEL} - ${CTEST_BUILD_NAME} --") >>> ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") >>> >>> >>> >>> On Windows XP and on Ubuntu Linux Server 11.10 it works and I get coverage >>> information. >>> >>> But on OS X Lion Server I didn't get any coverage informations. >>> >>> On OS X the command gcov is available. >>> >>> >>> Could someone please help? >>> >>> >>> Thanks in advance >>> >>> >>> Best Regards >>> >>> NoRulez >>> >>> >>> -- >>> >>> 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