diff --git a/CMakeLists.txt b/CMakeLists.txt index 194da4434..46864bf76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,10 +15,11 @@ else () endif () if (ASAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak") - # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak") + string(REPLACE "," ";" ASANS ${ASAN}) + foreach (SANITIZE ${ASANS}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZE}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZE}") + endforeach () endif () if (NOT CMAKE_BUILD_TYPE) diff --git a/configure b/configure index 779ffa849..ee8e73bc0 100755 --- a/configure +++ b/configure @@ -102,7 +102,10 @@ while [ -n "$1" ]; do CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_NO_ELISP_BYTECOMPILE=1" ;; --asan) - CMAKE_ARGS="${CMAKE_ARGS} -DASAN=1" + CMAKE_ARGS="${CMAKE_ARGS} -DASAN=address,undefined" + ;; + --asan=*) + CMAKE_ARGS="${CMAKE_ARGS} -DASAN=`echo $1 | sed -e 's,--asan=,,'`" ;; --elisp-install-location) shift