mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Build/Misc: Add ASan CMake flag
Allow to enable/disable Address Sanitizer in Clang and GCC from CMake flag "ASAN" of type Boolean. It can be enabled passing -DASAN=TRUE to CMake.
(cherry picked from commit 580f40769c)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -104,6 +104,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!")
|
||||
|
||||
Reference in New Issue
Block a user