cmake: enable AddressSanitizer in Debug builds

This commit is contained in:
Christian Rauch 2021-01-31 19:09:25 -08:00
parent 3ae2ec34fa
commit f8b4a6e25a
1 changed files with 17 additions and 0 deletions

View File

@ -2323,6 +2323,23 @@ if(SDL_STATIC)
endif() endif()
endif() endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} \
-fsanitize=address \
-fsanitize=bool \
-fsanitize=bounds \
-fsanitize=enum \
-fsanitize=float-cast-overflow \
-fsanitize=float-divide-by-zero \
-fsanitize=nonnull-attribute \
-fsanitize=returns-nonnull-attribute \
-fsanitize=signed-integer-overflow \
-fsanitize=undefined \
-fsanitize=vla-bound \
-fno-sanitize=alignment \
-fsanitize=leak \
-fsanitize=object-size \
")
##### Tests ##### ##### Tests #####
if(SDL_TEST) if(SDL_TEST)