Add 'WITH_ASAN' cmake option to enable AddressSanitizer compile options

This commit is contained in:
Nyall Dawson 2022-08-10 09:55:39 +10:00
parent 0580369dbf
commit c5a65094a2

View File

@ -1042,6 +1042,16 @@ if (WITH_CORE)
endif()
endif()
####################################################
# asan
set (WITH_ASAN FALSE CACHE BOOL "Use AddressSanitizer")
mark_as_advanced(WITH_ASAN)
if(WITH_ASAN)
message(STATUS "Enabling AddressSanitizer")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
#############################################################
# process subdirs