From 2d3d3ae46e78d632170c68047c25217c0b9c9e82 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 17 Jun 2023 17:01:16 +0200 Subject: [PATCH] Make sanitizers truly optional (#4689) --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d433a0ec..340e8a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ if (WIN32) find_package(WinToast REQUIRED) endif () -find_package(Sanitizers) +find_package(Sanitizers QUIET) # Find boost on the system # `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 465a147f..b7465ebd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -710,7 +710,12 @@ if (BUILD_APP) else() add_executable(${EXECUTABLE_PROJECT} main.cpp) endif() - add_sanitizers(${EXECUTABLE_PROJECT}) + + if(COMMAND add_sanitizers) + add_sanitizers(${EXECUTABLE_PROJECT}) + else() + message(WARNING "Sanitizers support is disabled") + endif() target_include_directories(${EXECUTABLE_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/autogen/)