aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2014-05-22 21:44:06 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2015-02-18 18:05:53 +0000
commit0dd7714d4da9824cc1294d6e200dfc9f44fba182 (patch)
treefbb951d002e3ce538863105318039347a874d6f3 /CMakeLists.txt
parentb35688760a6827639ecb4e1230d1a181e5048342 (diff)
Add AddressSanitizer (ASAN) build option
--enable-asan for autotools -D ENABLE_ASAN:BOOL=TRUE for CMake Need Clang/LLVM >= 3.1 or GCC >= 4.9 More information about ASAN https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer Change-Id: I833d4216d9508b8f7550ebc1dff6326734bdb53a Reviewed-on: https://code.wireshark.org/review/1727 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ceeed1e3e..cf5c017f10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -354,6 +354,17 @@ else()
)
endif()
+ set(WIRESHARK_ASAN_FLAGS
+ # With Clang >= 3.5 Leak detection is enable by default
+ # and no yet all leak is fixed...
+ # use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
+ -fsanitize=address
+ )
+
+ if(ENABLE_ASAN)
+ set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_ASAN_FLAGS})
+ endif()
+
if(ENABLE_EXTRA_COMPILER_WARNINGS) # This overrides -Werror
set(WIRESHARK_COMMON_FLAGS ${WIRESHARK_COMMON_FLAGS} ${WIRESHARK_EXTRA_COMPILER_COMMON_FLAGS})
set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS} ${WIRESHARK_EXTRA_COMPILER_C_ONLY_FLAGS})