File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ option(BuildJK2SPGame "Whether to create projects for the jk2 sp gamecode mod (j
50
50
option (BuildJK2SPRdVanilla "Whether to create projects for the jk2 sp renderer (rdjosp-vanilla_x86.dll)" OFF )
51
51
52
52
option (BuildTests "Whether to build automatic unit tests (requires Boost)" OFF )
53
- option (UseSanitizer "Whether to enable runtime sanitizers (e.g. AddressSanitizer)" OFF )
53
+ option (UseAddressSanitizer "Whether to enable runtime address sanitizer" OFF )
54
+ option (UseUndefinedSanitizer "Whether to enable runtime Undefined Behavior sanitizer" OFF )
54
55
55
56
include (CMakeDependentOption )
56
57
cmake_dependent_option (BuildSymbolServer "Build WIP Windows Symbol Server (experimental and unused)" OFF "NOT WIN32 OR NOT MSVC" OFF )
@@ -245,9 +246,14 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M
245
246
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
246
247
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
247
248
248
- if (CMAKE_BUILD_TYPE MATCHES "DEBUG" OR CMAKE_BUILD_TYPE MATCHES "Debug" AND UseSanitizer )
249
+ if (UseAddressSanitizer )
250
+ # also raise stack size drastically (to 64MiB), since the sanitizer adds overhead to stack frames
249
251
add_compile_options (-fsanitize=address )
250
- add_link_options (-fsanitize=address )
252
+ add_link_options (-fsanitize=address -z stack-size=4000000 )
253
+ endif ()
254
+ if (UseUndefinedSanitizer )
255
+ add_compile_options (-fsanitize=undefined )
256
+ add_link_options (-fsanitize=undefined )
251
257
endif ()
252
258
253
259
# additional flags for debug configuration
You can’t perform that action at this time.
0 commit comments