mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Add support for AddressSanitizer instrumentation (#189)
To use, just set `ADDRESS_SANITIZER` to `ON` on the command-line or your CMakeUserPresets.json file
This commit is contained in:
@@ -9,6 +9,12 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
option(ADDRESS_SANITIZER OFF)
|
||||
if(ADDRESS_SANITIZER)
|
||||
message(STATUS "AddressSanitizer ENABLED for non-Release builds")
|
||||
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
|
||||
endif()
|
||||
|
||||
# whether we are using MSBuild as a generator
|
||||
set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user