From 4dc3b6116ea3e9b66db2fa88e389f5874f2f9141 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 19 Nov 2021 17:41:10 +0100 Subject: [PATCH] Add UBsan build type --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca7b71f..6ef7350 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel or Asan." FORCE) + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Asan UBsan." FORCE) endif(NOT CMAKE_BUILD_TYPE) include(CheckIPOSupported) @@ -65,6 +65,9 @@ set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} \ -fno-omit-frame-pointer" CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." FORCE) +set(CMAKE_C_FLAGS_UBSAN "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined" + CACHE STRING "Flags used by the C compiler during UndefinedBehaviorSanitizer builds." FORCE) + add_library(ovni SHARED ovni.c parson.c