diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a0b540f12d2..579c8a21783 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,21 +203,17 @@ OPTION(WITH_ASAN "Enable address sanitizer" OFF) IF (WITH_ASAN AND NOT MSVC) # this flag might be set by default on some OS MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) - # gcc 4.8.1 and new versions of clang MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fPIC" DEBUG RELWITHDEBINFO) SET(HAVE_C_FSANITIZE ${have_C__fsanitize_address__fPIC}) SET(HAVE_CXX_FSANITIZE ${have_CXX__fsanitize_address__fPIC}) IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE) + OPTION(WITH_ASAN_SCOPE "Enable -fsanitize-address-use-after-scope" OFF) SET(WITH_ASAN_OK 1) - ELSE() - # older versions of clang - MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -fPIC" - DEBUG RELWITHDEBINFO) - SET(HAVE_C_FADDRESS ${have_C__faddress_sanitizer__fPIC}) - SET(HAVE_CXX_FADDRESS ${have_CXX__faddress_sanitizer__fPIC}) - IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS) - SET(WITH_ASAN_OK 1) + IF(WITH_ASAN_SCOPE) + MY_CHECK_AND_SET_COMPILER_FLAG( + "-fsanitize=address -fsanitize-address-use-after-scope" + DEBUG RELWITHDEBINFO) ENDIF() ENDIF() |