make AddressSanitizer optional and disabled by default

main
Christian Rauch 2021-02-08 23:55:50 +03:00
parent 5045d299a6
commit 2170c7bfde
1 changed files with 2 additions and 1 deletions

View File

@ -401,6 +401,7 @@ option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal
option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF")
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
set_option(JOYSTICK_VIRTUAL "Enable the virtual-joystick driver" ON)
set_option(ASAN "Use AddressSanitizer to detect memory errors" OFF)
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library")
@ -2350,7 +2351,7 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
endmacro()
# enable AddressSanitizer if supported
if ( (CMAKE_C_COMPILER_ID STREQUAL "GNU") AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4)
if (ASAN)
asan_check_add_debug_flag2("address")
asan_check_add_debug_flag("bool")
asan_check_add_debug_flag("bounds")