diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-01-09 13:13:26 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-01-12 08:12:45 +0100 |
| commit | 3f373b06b05083d9395250379a2978b5f6085002 (patch) | |
| tree | c6edaa135feac5336ec0e6601772ad6f513c8a2f /cmake/dependencies | |
| parent | 5b11550644b0ce7a79b967b6aabb1a59b86d5ca2 (diff) | |
| download | ouroboros-3f373b06b05083d9395250379a2978b5f6085002.tar.gz ouroboros-3f373b06b05083d9395250379a2978b5f6085002.zip | |
build: Add build target to generate coverage report
This adds a 'make coverage' option to conveniently summarize test
coverage. If lcov is installed, it will also automatically generate
the HTML summary.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'cmake/dependencies')
| -rw-r--r-- | cmake/dependencies/gcov.cmake | 11 | ||||
| -rw-r--r-- | cmake/dependencies/lcov.cmake | 17 |
2 files changed, 28 insertions, 0 deletions
diff --git a/cmake/dependencies/gcov.cmake b/cmake/dependencies/gcov.cmake new file mode 100644 index 00000000..c4d1caf0 --- /dev/null +++ b/cmake/dependencies/gcov.cmake @@ -0,0 +1,11 @@ +find_program(GCOV_PATH gcov) + +if (GCOV_PATH) + set(HAVE_GCOV TRUE CACHE INTERNAL "") + message(STATUS "gcov found - coverage analysis available") +else () + set(HAVE_GCOV FALSE CACHE INTERNAL "") + message(STATUS "gcov not found - coverage analysis not available") +endif () + +mark_as_advanced(GCOV_PATH) diff --git a/cmake/dependencies/lcov.cmake b/cmake/dependencies/lcov.cmake new file mode 100644 index 00000000..db559332 --- /dev/null +++ b/cmake/dependencies/lcov.cmake @@ -0,0 +1,17 @@ +find_program(LCOV_PATH lcov) +find_program(GENHTML_PATH genhtml) + +if (LCOV_PATH AND GENHTML_PATH) + set(HAVE_LCOV TRUE CACHE INTERNAL "") + message(STATUS "lcov and genhtml found - HTML coverage reports available") +else () + set(HAVE_LCOV FALSE CACHE INTERNAL "") + if (NOT LCOV_PATH) + message(STATUS "lcov not found - HTML coverage reports not available") + endif () + if (NOT GENHTML_PATH) + message(STATUS "genhtml not found - HTML coverage reports not available") + endif () +endif () + +mark_as_advanced(LCOV_PATH GENHTML_PATH) |
