From 087f135085b51aefed7464df291c4f37e862f229 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 9 Nov 2023 15:06:15 -0800 Subject: [PATCH] Add coverage option for Asan builds. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c67221a98e..fb3f79e2a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ option (WITH_OFX "compile with ofx support (needs LibOFX)" ON) option (WITH_PYTHON "enable python plugin and bindings" OFF) option (ENABLE_BINRELOC "compile with binary relocation support" ON) option (DISABLE_NLS "do not use Native Language Support" OFF) +option (COVERAGE "Instrument an Asan build for coverage reporting" OFF) # ############################################################ # These are also settable from the command line in a similar way. @@ -623,6 +624,9 @@ elseif(UNIX) set(ASAN_DYNAMIC_LIB_ENV "LD_PRELOAD=${PRELOADS};ASAN_OPTIONS=${ASAN_OPTIONS}") endif () set(ASAN_BUILD_OPTIONS -fsanitize=address -fsanitize=undefined) +if (COVERAGE) + list(APPEND ASAN_BUILD_OPTIONS --coverage) +endif() set(ASAN_COMPILE_OPTIONS -g ${ASAN_BUILD_OPTIONS}) add_compile_options("$<$:${ASAN_COMPILE_OPTIONS}>") add_link_options("$<$:${ASAN_BUILD_OPTIONS}>")