summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshfil <filip.gawin@zoho.com>2021-01-24 21:34:53 +0100
committerGitHub <noreply@github.com>2021-01-24 21:34:53 +0100
commit1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b (patch)
treee7e13247a2584bfa403ab4cc222af622d73ddb15
parentPed: car enter anim. fix (diff)
downloadre3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar.gz
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar.bz2
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar.lz
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar.xz
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.tar.zst
re3-1d3b4d1e9a16c5eddd5f71e50b1e8a082f58676b.zip
-rw-r--r--src/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dc204d17..df39c7c9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -79,6 +79,21 @@ endif()
target_compile_definitions(${EXECUTABLE} PRIVATE )
+option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
+option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
+
+if(${PROJECT}_WITH_SANITIZERS)
+ target_compile_options(${EXECUTABLE} PUBLIC
+ -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
+ -g3 -fno-omit-frame-pointer)
+ target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
+endif()
+
+if(${PROJECT}_WITH_ASAN)
+ target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
+ target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
+endif()
+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(${EXECUTABLE}
PRIVATE