File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ option(BuildJK2SPGame "Whether to create projects for the jk2 sp gamecode mod (j
49
49
option (BuildJK2SPRdVanilla "Whether to create projects for the jk2 sp renderer (rdjosp-vanilla_x86.dll)" OFF )
50
50
51
51
option (BuildTests "Whether to build automatic unit tests (requires Boost)" OFF )
52
+ option (UseSanitizer "Whether to enable runtime sanitizers (e.g. AddressSanitizer)" OFF )
52
53
53
54
include (CMakeDependentOption)
54
55
cmake_dependent_option(BuildSymbolServer "Build WIP Windows Symbol Server (experimental and unused)" OFF "NOT WIN32 OR NOT MSVC" OFF )
@@ -234,6 +235,11 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M
234
235
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
235
236
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
236
237
238
+ if (CMAKE_BUILD_TYPE MATCHES "DEBUG" OR CMAKE_BUILD_TYPE MATCHES "Debug" AND UseSanitizer)
239
+ add_compile_options (-fsanitize=address)
240
+ add_link_options (-fsanitize=address)
241
+ endif ()
242
+
237
243
# additional flags for debug configuration
238
244
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb" )
239
245
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb" )
You can’t perform that action at this time.
0 commit comments