[CMake] Nice handling of code coverage option?

Brad Hards bradh at frogmouth.net
Tue Mar 23 19:58:48 EDT 2010


Hi,

I've seen a few projects that do code coverage setup within cmake, but nothing 
that does it really "nicely". 

My idea of nice is that the coverage:
- it mostly done in a module that I can just "INCLUDE( MagicCoverage )"
- is controlled by a cmake OPTION()
- automatically gets the right coverage tool for the CMAKE_CXX_COMPILER (or 
warns about not being able to find an appropriate coverage tool)
- adds the right compiler / linker flags
- has a makefile (or equivalent) target to run the coverage tool.

It would be nice if it also handled the C compiler and warned if there was a 
conflict. 
lcov support would also be nice.

It would be enough for now to just handle g++ / gcov, although I'd like to be 
able to extend to at least the Intel compiler.

Does anyone have such a thing (or a similar thing) that they can share?

If not, does anyone have parts that might help (especially reliably detecting 
which compiler is being used)?

Thanks for any suggestions.

Brad


More information about the CMake mailing list