cmake: fix linking asan

This commit is contained in:
Xiaofeng Wang 2022-09-19 21:00:48 +08:00
parent b77c19c969
commit c282775205

View File

@ -308,6 +308,10 @@ endif()
if(ENABLE_ASAN) if(ENABLE_ASAN)
list(APPEND COMPILE_OPTIONS_DEFAULT list(APPEND COMPILE_OPTIONS_DEFAULT
"-fsanitize=address;-fno-omit-frame-pointer") "-fsanitize=address;-fno-omit-frame-pointer")
# https://github.com/google/sanitizers/wiki/AddressSanitizer#using-addresssanitizer
# > In order to use AddressSanitizer you will need to
# > compile and link your program using clang with the -fsanitize=address switch.
update_cached_list(MK_LINK_LIBRARIES "-fsanitize=address")
message(STATUS "已启用 Address Sanitize") message(STATUS "已启用 Address Sanitize")
endif() endif()