From e2475b4c6eeecf73912e116a229e18ab99ba532a Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 5 Dec 2024 15:04:32 +0100 Subject: [PATCH] port/posix-h4: add asan build on debug --- port/posix-h4/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/port/posix-h4/CMakeLists.txt b/port/posix-h4/CMakeLists.txt index 71c8f4a73..8161d0057 100644 --- a/port/posix-h4/CMakeLists.txt +++ b/port/posix-h4/CMakeLists.txt @@ -17,6 +17,14 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") # using Visual Studio C++ endif() +if(CMAKE_BUILD_TYPE MATCHES "Debug") + add_compile_options( + -fsanitize=undefined -fsanitize=address + ) + add_link_options( + -fsanitize=undefined -fsanitize=address + ) +endif() # to generate .h from .gatt files find_package (Python REQUIRED COMPONENTS Interpreter)