Make sanitizers truly optional (#4689)

This commit is contained in:
pajlada 2023-06-17 17:01:16 +02:00 committed by GitHub
parent 36bc8e0520
commit 2d3d3ae46e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -91,7 +91,7 @@ if (WIN32)
find_package(WinToast REQUIRED) find_package(WinToast REQUIRED)
endif () endif ()
find_package(Sanitizers) find_package(Sanitizers QUIET)
# Find boost on the system # Find boost on the system
# `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link. # `OPTIONAL_COMPONENTS random` is required for vcpkg builds to link.

View file

@ -710,7 +710,12 @@ if (BUILD_APP)
else() else()
add_executable(${EXECUTABLE_PROJECT} main.cpp) add_executable(${EXECUTABLE_PROJECT} main.cpp)
endif() 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/) target_include_directories(${EXECUTABLE_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/autogen/)