From 7e4e488f00f60fe3a0241c42d0034e1a7617e1bd Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Mar 2022 20:44:39 +0100 Subject: build: Add debug option for fsanitize=undefined The sanitizer for undefined behaviour can now be enabled using DebugUSan build option for convenience. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27fe03ef..eeea8f7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(PACKAGE_VERSION if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Build type (Release, Debug, DebugASan, DebugTSan, DebugLSan, DebugAnalyzer)" FORCE) + "Build type (Release, Debug, DebugASan, DebugTSan, DebugLSan, DebugUSan, DebugAnalyzer)" FORCE) endif() if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -104,6 +104,8 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "DebugTSan") test_and_set_c_compiler_flag_global(-fsanitize=thread) elseif (CMAKE_BUILD_TYPE STREQUAL "DebugLSan") test_and_set_c_compiler_flag_global(-fsanitize=leak) +elseif (CMAKE_BUILD_TYPE STREQUAL "DebugUSan") + test_and_set_c_compiler_flag_global(-fsanitize=undefined) elseif (CMAKE_BUILD_TYPE STREQUAL "DebugAnalyzer") test_and_set_c_compiler_flag_global(-fanalyzer) endif () -- cgit v1.2.3