The cpptestcc code instrumentation utility is designed as a prefix for the compilation command lines invoked by your build system.  

When integrating cpptestcc with your build, depending on your requirements, you can either add a dedicated build configuration for the coverage mode alongside the typical Release and Debug configurations, or modify an existing configuration to include coverage instrumentation. 

See below for examples of regular and coverage mode compilation command lines.

Regular compilation command line, invoked by the build system for typical Release/Debug build configurations: 

cc -I app/includes -D defines -c source.cpp

Coverage-enabled mode compilation command line: 

cpptestcc -compiler gcc_9-64 -line-coverage -workspace /home/test/proj/cov -- cc -I app/includes -D defines -c source.cpp 

When the coverage-enabled mode compilation command line is executed, cpptestcc performs the following operations: 

Coverage mode compilation command lines must follow the pattern below: 

cpptestcc -compiler <compiler configuration> <coverage metric specification> <additional options> -workspace <workspace directory> -- <compilation command line> 

You can add the <INSTALL_DIR>/bin directory to your PATH variable so that you do not have to use full paths when specifying the cpptestcc command. All examples in this documentation assume this has been done. 

Changes in your build scrips required for integrating cpptestcc coverage instrumentation depend on your build system and project-specific build script configuration. Inspect your build scripts and build system documentation for instructions on modifying compilation rules.