Skip to content

Commit

Permalink
Enable address sanitizer for debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Nov 25, 2024
1 parent f1981f0 commit aa4feee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ if(VALGRIND)
find_program(VALGRIND_BIN valgrind REQUIRED)
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
endif()

macro(use_cxx17)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down

0 comments on commit aa4feee

Please sign in to comment.