aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/compiler/clang/settings.cmake18
-rw-r--r--cmake/compiler/gcc/settings.cmake18
-rw-r--r--cmake/showoptions.cmake7
3 files changed, 43 insertions, 0 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index fd690d2405b..f958d8c16ae 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -25,6 +25,24 @@ if(WITH_COREDEBUG)
message(STATUS "Clang: Debug-flags set (-g3)")
endif()
+if(ASAN)
+ target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=address
+ -fsanitize-recover=address
+ -fsanitize-address-use-after-scope)
+
+ target_link_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=address
+ -fsanitize-recover=address
+ -fsanitize-address-use-after-scope)
+
+ message(STATUS "Clang: Enabled Address Sanitizer")
+endif()
+
# -Wno-narrowing needed to suppress a warning in g3d
# -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems.
target_compile_options(trinity-compile-option-interface
diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake
index 9139a028f18..b2d427ecbeb 100644
--- a/cmake/compiler/gcc/settings.cmake
+++ b/cmake/compiler/gcc/settings.cmake
@@ -44,6 +44,24 @@ if( WITH_COREDEBUG )
message(STATUS "GCC: Debug-flags set (-g3)")
endif()
+if(ASAN)
+ target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=address
+ -fsanitize-recover=address
+ -fsanitize-address-use-after-scope)
+
+ target_link_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=address
+ -fsanitize-recover=address
+ -fsanitize-address-use-after-scope)
+
+ message(STATUS "GCC: Enabled Address Sanitizer")
+endif()
+
if (BUILD_SHARED_LIBS)
target_compile_options(trinity-compile-option-interface
INTERFACE
diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake
index 6094198e76a..d53792ef484 100644
--- a/cmake/showoptions.cmake
+++ b/cmake/showoptions.cmake
@@ -105,6 +105,13 @@ if ( HELGRIND )
add_definitions(-DHELGRIND)
endif()
+if ( ASAN )
+ message("")
+ message(" *** ASAN - WARNING!")
+ message(" *** Please note that this is for DEBUGGING WITH ADDRESS SANITIZER only!")
+ add_definitions(-DASAN)
+endif()
+
if ( PERFORMANCE_PROFILING )
message("")
message(" *** PERFORMANCE_PROFILING - WARNING!")