aboutsummaryrefslogtreecommitdiff
path: root/cmake/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/compiler')
-rw-r--r--cmake/compiler/clang/settings.cmake18
-rw-r--r--cmake/compiler/gcc/settings.cmake18
2 files changed, 36 insertions, 0 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index 53ff022a7e0..cc756a92131 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -36,6 +36,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.
# -Wno-deprecated-copy needed to suppress a warning in g3d
diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake
index f5a249bfba0..abf9fa5acf7 100644
--- a/cmake/compiler/gcc/settings.cmake
+++ b/cmake/compiler/gcc/settings.cmake
@@ -48,6 +48,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