From b72b95bc140394514ec138a278e85181c19c5240 Mon Sep 17 00:00:00 2001 From: Deepthi C Shetty <115452109+dshett549@users.noreply.github.com> Date: Fri, 15 Mar 2024 19:03:47 +0530 Subject: [PATCH] RDKB-54346: Add AddressSanitizer as a CMake build option for the rbus code (#197) Reason for change: Add AddressSanitizer as a CMake build option for the rbus code Test Procedure: Test and verified. Risks: Medium Priority: P1 Signed-off-by: Deepthi C Shetty --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d32a3a4..0deae2be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,11 @@ set(CMAKE_C_FLAGS_RELEASE "-fPIC -Wall -Werror -Wextra ${CMAKE_C_FLAGS_RELEASE} set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -Wall -Werror -Wextra -Wno-type-limits -fno-inline ${CMAKE_C_FLAGS_DEBUG} -DRBUS_ALWAYS_ON ") set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -Wall -Werror -Wextra ${CMAKE_C_FLAGS_RELEASE} -DRBUS_ALWAYS_ON ") +if(ENABLE_ADDRESS_SANITIZER) + set(CMAKE_C_FLAGS "-fsanitize=address ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-fsanitize=address ${CMAKE_CXX_FLAGS}") +endif(ENABLE_ADDRESS_SANITIZER) + include(GNUInstallDirs) IF (NOT DEFINED CMAKE_INSTALL_BINDIR)