From c282775205c856f10d8b9b9091db3a7eefec1630 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Mon, 19 Sep 2022 21:00:48 +0800 Subject: [PATCH] cmake: fix linking asan --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2fd2e04..94c9042c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,6 +308,10 @@ endif() if(ENABLE_ASAN) list(APPEND COMPILE_OPTIONS_DEFAULT "-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") endif()