Add address sanitizer to debug flags.

This commit is contained in:
tastytea 2021-06-04 23:08:50 +02:00
parent 4b09158037
commit cb2aee847f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
"-Wformat=2"
"-ftrapv"
"-fsanitize=undefined"
"-fsanitize=address"
"-Og"
"-fno-omit-frame-pointer")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@ -45,7 +46,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
add_compile_options("$<$<CONFIG:Debug>:${tmp_CXXFLAGS}>")
list(APPEND tmp_LDFLAGS
"-fsanitize=undefined")
"-fsanitize=undefined"
"-fsanitize=address")
# add_link_options was introduced in version 3.13.
if(${CMAKE_VERSION} VERSION_LESS 3.13)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${tmp_LDFLAGS}")