|
@@ -5,6 +5,7 @@ option(BUILD_EXAMPLES "Build the examples." ON)
|
|
option(BUILD_GAMES "Build the example games." ON)
|
|
option(BUILD_GAMES "Build the example games." ON)
|
|
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
|
option(ENABLE_ASAN "Enable AddressSanitizer (ASAN) for debugging (degrades performance)" OFF)
|
|
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan) for debugging" 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_VERSION VERSION_LESS "3.1")
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
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(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
|
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
|
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
|
endif()
|
|
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)
|
|
add_subdirectory(src release)
|
|
|
|
|