diff --git a/CMakeLists.txt b/CMakeLists.txt index 729a07c..d2d2609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,10 @@ 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/test/CMakeLists.txt b/test/CMakeLists.txt index 0ae0b45..ef3a1ff 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,7 +53,13 @@ target_include_directories(StormTest 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_link_options(StormTest + PUBLIC -fsanitize=address + ) endif() install(TARGETS StormTest DESTINATION "bin")