Add address sanitizer to debug flags.
This commit is contained in:
parent
4b09158037
commit
cb2aee847f
|
@ -25,6 +25,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
|
||||||
"-Wformat=2"
|
"-Wformat=2"
|
||||||
"-ftrapv"
|
"-ftrapv"
|
||||||
"-fsanitize=undefined"
|
"-fsanitize=undefined"
|
||||||
|
"-fsanitize=address"
|
||||||
"-Og"
|
"-Og"
|
||||||
"-fno-omit-frame-pointer")
|
"-fno-omit-frame-pointer")
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
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}>")
|
add_compile_options("$<$<CONFIG:Debug>:${tmp_CXXFLAGS}>")
|
||||||
|
|
||||||
list(APPEND tmp_LDFLAGS
|
list(APPEND tmp_LDFLAGS
|
||||||
"-fsanitize=undefined")
|
"-fsanitize=undefined"
|
||||||
|
"-fsanitize=address")
|
||||||
# add_link_options was introduced in version 3.13.
|
# add_link_options was introduced in version 3.13.
|
||||||
if(${CMAKE_VERSION} VERSION_LESS 3.13)
|
if(${CMAKE_VERSION} VERSION_LESS 3.13)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${tmp_LDFLAGS}")
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${tmp_LDFLAGS}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user