diff --git a/cmake/IgnCodeCoverage.cmake b/cmake/IgnCodeCoverage.cmake index 1f2244c2..20691d01 100644 --- a/cmake/IgnCodeCoverage.cmake +++ b/cmake/IgnCodeCoverage.cmake @@ -120,6 +120,17 @@ FUNCTION(ign_setup_target_for_coverage) MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") ENDIF() # NOT GENHTML_PATH + # Read ignore file list + if (EXISTS "${PROJECT_SOURCE_DIR}/coverage.ignore.in") + configure_file("${PROJECT_SOURCE_DIR}/coverage.ignore.in" + ${PROJECT_BINARY_DIR}/coverage.ignore) + file (STRINGS "${PROJECT_BINARY_DIR}/coverage.ignore" IGNORE_LIST_RAW) + string(REGEX REPLACE "([^;]+)" "'${PROJECT_SOURCE_DIR}/\\1'" IGNORE_LIST "${IGNORE_LIST_RAW}") + message(STATUS "Ignore coverage additions: " ${IGNORE_LIST}) + else() + set(IGNORE_LIST "") + endif() + # Setup target ADD_CUSTOM_TARGET(${_targetname} @@ -132,8 +143,8 @@ FUNCTION(ign_setup_target_for_coverage) # Remove negative counts COMMAND sed -i '/,-/d' ${_outputname}.info COMMAND ${LCOV_PATH} ${_branch_flags} -q - --remove ${_outputname}.info '*/test/*' '/usr/*' '*_TEST*' '*.cxx' 'moc_*.cpp' 'qrc_*.cpp' '*.pb.*' --output-file ${_outputname}.info.cleaned - COMMAND ${GENHTML_PATH} ${_branch_flags} -q + --remove ${_outputname}.info '*/test/*' '/usr/*' '*_TEST*' '*.cxx' 'moc_*.cpp' 'qrc_*.cpp' '*.pb.*' '*/build/*' '*/install/*' ${IGNORE_LIST} --output-file ${_outputname}.info.cleaned + COMMAND ${GENHTML_PATH} ${_branch_flags} -q --prefix ${PROJECT_SOURCE_DIR} --legend -o ${_outputname} ${_outputname}.info.cleaned COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "lines" | cut -d ' ' -f 4 | cut -d '%' -f 1 > ${_outputname}/lines.txt COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "functions" | cut -d ' ' -f 4 | cut -d '%' -f 1 > ${_outputname}/functions.txt