From a5c589f5a93599202a7c4d6a1bcdcc14df4e4a45 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Fri, 26 Dec 2025 14:06:15 -0600 Subject: [PATCH] chore(build): use target-specific directives when enabling ASan --- CMakeLists.txt | 4 ---- storm/CMakeLists.txt | 3 +++ test/CMakeLists.txt | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b380767..22555f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,10 +79,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug") LCOV_ARGS --rc branch_coverage=1 GENHTML_ARGS --rc genhtml_branch_coverage=1 ) - - # Enable ASan for debug builds on gcc - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") endif() if(WHOA_TEST_STORMDLL) diff --git a/storm/CMakeLists.txt b/storm/CMakeLists.txt index 55cea8b..635fc15 100644 --- a/storm/CMakeLists.txt +++ b/storm/CMakeLists.txt @@ -65,4 +65,7 @@ endif() if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug") include(CodeCoverage) target_compile_options(${PROJECT_NAME} PRIVATE -g -fprofile-arcs -ftest-coverage -O0) + + # Enable ASan for debug builds on gcc + target_compile_options(storm PRIVATE -fsanitize=address -fno-omit-frame-pointer) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ef3a1ff..965551b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -57,9 +57,8 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_options(${PROJECT_NAME} PRIVATE -g -fprofile-arcs -ftest-coverage -O0) # Enable ASan for debug builds on gcc - target_link_options(StormTest - PUBLIC -fsanitize=address - ) + target_compile_options(StormTest PRIVATE -fsanitize=address -fno-omit-frame-pointer) + target_link_options(StormTest PRIVATE -fsanitize=address) endif() install(TARGETS StormTest DESTINATION "bin")