1 2 macro(MAKE_LCOV_TARGET name) 3 add_custom_target(${name}-lcov lcov -d ${PROJECT_BINARY_DIR}/${name}/CMakeFiles/${name}.dir -o ${name}.info -c > /dev/null WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${name} COMMENT "Running lcov for ${name}" VERBATIM) 4 endmacro() 5 6 macro(MAKE_LCOV_REPORT_TARGET target exe-targets projects outdir title) 7 foreach (PRJ ${projects}) 8 MAKE_LCOV_TARGET(${PRJ}) 9 set(INFO_FILES ${PRJ}/${PRJ}.info ${INFO_FILES}) 10 add_dependencies(${PRJ}-lcov ${exe-targets}) 11 set(LCOV_PRJS ${LCOV_PRJS} ${PRJ}-lcov) 12 endforeach() 13 add_custom_target(${target} ALL genhtml -o ${outdir} -t "${title}" ${INFO_FILES} | grep "\\.\\.:" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" COMMENT "Generate LCOV HTML report" VERBATIM) 14 add_dependencies(${target} ${LCOV_PRJS}) 15 16 endmacro() 17