From aefde2b3dfcc5e4f2984cdbd4c831620fe1b241d Mon Sep 17 00:00:00 2001 From: Deepthi C Shetty Date: Thu, 14 Mar 2024 18:01:58 +0530 Subject: [PATCH] RDKB-54346: Add AddressSanitizer as a CMake build option for the rbus code 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)