summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2018-03-14 16:11:29 +0100
committerGitHub <[email protected]>2018-03-14 16:11:29 +0100
commit4cae2b8829afb3286da3a5e3b514c4752a332726 (patch)
tree4a6795b654f635fbfbffd0cbb460621e126b6e18
parentb9573e583f02fcdc0b283bacff3cb2025aebfa3d (diff)
parent4c0925067a93d6b011eda47f2204a926a76d37ed (diff)
downloadraylib-4cae2b8829afb3286da3a5e3b514c4752a332726.tar.gz
raylib-4cae2b8829afb3286da3a5e3b514c4752a332726.zip
Merge pull request #505 from Martinfx/max-add-memory-sanitizer
Add memory sanitizer for better debug
-rwxr-xr-xCMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d98ffea..6d5994f4 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ option(BUILD_EXAMPLES "Build the examples." ON)
option(BUILD_GAMES "Build the example games." ON)
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" OFF)
+option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended for run with ASAN)" OFF)
if(CMAKE_VERSION VERSION_LESS "3.1")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
@@ -40,6 +41,14 @@ if (ENABLE_UBSAN)
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
endif()
+if (ENABLE_MSAN)
+ add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+ add_if_flag_works(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
+endif()
+
+if (ENABLE_MSAN AND ENABLE_ASAN)
+ MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
+endif()
add_subdirectory(src release)