From 2e147367eb10a15787aa4caeb65e2193e552d12c Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 20 Feb 2026 10:41:25 -0500 Subject: [PATCH] Add lsan cmake flag --- CMakeLists.txt | 1 + src/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5fedcc4d..5d9cf177d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,6 +91,7 @@ option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF) option(SRB2_CONFIG_TRACY "Compile with Tracy profiling enabled" OFF) option(SRB2_CONFIG_ASAN "Compile with AddressSanitizer (libasan)." OFF) option(SRB2_CONFIG_UBSAN "Compile with UndefinedBehaviorSanitizer (libubsan)." OFF) +option(SRB2_CONFIG_LSAN "Compile with LeakSanitizer (liblsan)." OFF) option(SRB2_CONFIG_NOVERIFYIWADS "Compile with IWAD verification turned off." OFF) set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.") option(SRB2_CONFIG_LTO "Enable link time optimizations, improves performance at the cost of longer link times." ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57cf129dc..4a2db6a7b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -244,6 +244,11 @@ if(SRB2_CONFIG_UBSAN) target_link_options(BLANKART PRIVATE -fsanitize=undefined) endif() +if(SRB2_CONFIG_LSAN) + target_compile_options(BLANKART PRIVATE -fsanitize=leak) + target_link_options(BLANKART PRIVATE -fsanitize=leak) +endif() + if(SRB2_CONFIG_TIDY) set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*") endif()