Build: Add -DASAN option to build with AddressSanitizer support
Use this option only for debugging purposes.
This commit is contained in:
parent
825ca07561
commit
424e6e14f6
|
@ -92,6 +92,7 @@ mark_as_advanced(
|
|||
|
||||
option(BUILD_TEST_SUITE "Build the test suite" 0)
|
||||
option(BUILD_MAN "Build man pages" 1)
|
||||
option(ASAN "DEBUGGING: Build with AddressSanitizer (ASan) support" 0)
|
||||
|
||||
set(ZM_RUNDIR "/var/run/zm" CACHE PATH
|
||||
"Location of transient process files, default: /var/run/zm")
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
target_compile_options(zm-warning-interface
|
||||
INTERFACE
|
||||
-Wall)
|
||||
|
||||
if(ASAN)
|
||||
target_compile_options(zm-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=address
|
||||
-fsanitize-recover=address
|
||||
-fsanitize-address-use-after-scope)
|
||||
|
||||
target_link_options(zm-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=address
|
||||
-fsanitize-recover=address
|
||||
-fsanitize-address-use-after-scope)
|
||||
|
||||
message(STATUS "Clang: Enabled AddressSanitizer (ASan)")
|
||||
endif()
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
target_compile_options(zm-warning-interface
|
||||
INTERFACE
|
||||
-Wall)
|
||||
|
||||
if(ASAN)
|
||||
target_compile_options(zm-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=address
|
||||
-fsanitize-recover=address
|
||||
-fsanitize-address-use-after-scope)
|
||||
|
||||
target_link_options(zm-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=address
|
||||
-fsanitize-recover=address
|
||||
-fsanitize-address-use-after-scope)
|
||||
|
||||
message(STATUS "GCC: Enabled AddressSanitizer (ASan)")
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue