aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-07 21:04:08 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-07 21:09:30 +0200
commit48deb72574416f431da3e805c52dbc76101e327e (patch)
tree46f91990d1afb5e471e72a01e0ac9d8635147d2b /src
parentMakefile: add release target (diff)
downloadcimple-48deb72574416f431da3e805c52dbc76101e327e.tar.gz
cimple-48deb72574416f431da3e805c52dbc76101e327e.zip
support code coverage report generation
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6b9cddf..c26fe31 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,6 +5,12 @@ add_compile_options(-std=c17 -Wpedantic -Wall -Wextra $<$<NOT:$<CONFIG:Debug>>:-
# any features macros defined at all, and prepare to be amazed!
add_compile_definitions(_GNU_SOURCE)
+option(COVERAGE "Enable line coverage analysis")
+if(COVERAGE)
+ add_compile_options(--coverage -fprofile-update=atomic)
+ add_link_options(--coverage)
+endif()
+
# Valgrind on Ubuntu Focal doesn't like DWARF version 5 debug info generated
# by Clang 14.
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")