coverage.cmake (837B)
1 # ---- Variables ---- 2 3 # We use variables separate from what CTest uses, because those have 4 # customization issues 5 set( 6 COVERAGE_TRACE_COMMAND 7 lcov -c -q 8 -o "${PROJECT_BINARY_DIR}/coverage.info" 9 -d "${PROJECT_BINARY_DIR}" 10 --include "${PROJECT_SOURCE_DIR}/*" 11 CACHE STRING 12 "; separated command to generate a trace for the 'coverage' target" 13 ) 14 15 set( 16 COVERAGE_HTML_COMMAND 17 genhtml --legend -f -q 18 "${PROJECT_BINARY_DIR}/coverage.info" 19 -p "${PROJECT_SOURCE_DIR}" 20 -o "${PROJECT_BINARY_DIR}/coverage_html" 21 CACHE STRING 22 "; separated command to generate an HTML report for the 'coverage' target" 23 ) 24 25 # ---- Coverage target ---- 26 27 add_custom_target( 28 coverage 29 COMMAND ${COVERAGE_TRACE_COMMAND} 30 COMMAND ${COVERAGE_HTML_COMMAND} 31 COMMENT "Generating coverage report" 32 VERBATIM 33 )