From c41a9e801403c5fefd6abb7b7c9e3415bc84e031 Mon Sep 17 00:00:00 2001 From: FeignClaims Date: Wed, 27 Mar 2024 22:18:36 +0800 Subject: [PATCH] Disable gcc sanitizer on macos by default According to https://github.com/orgs/Homebrew/discussions/3384#discussioncomment-6264292, gcc now dosen't support libsanitizer on macOS with arm64 and macOS Ventuna or later with x86_64. --- src/DynamicProjectOptions.cmake | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/DynamicProjectOptions.cmake b/src/DynamicProjectOptions.cmake index 8f6c8b92..4cf62520 100644 --- a/src/DynamicProjectOptions.cmake +++ b/src/DynamicProjectOptions.cmake @@ -101,20 +101,14 @@ macro(dynamic_project_options) ) endif() - if((CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" OR CMAKE_CXX_COMPILER_ID MATCHES ".*GNU.*") - AND NOT WIN32 + if(((CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*") AND (NOT WIN32)) + OR ((CMAKE_CXX_COMPILER_ID MATCHES ".*GNU.*") AND (NOT WIN32) AND (NOT APPLE)) ) set(SUPPORTS_UBSAN ON) + set(SUPPORTS_ASAN ON) else() set(SUPPORTS_UBSAN OFF) - endif() - - if((CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" OR CMAKE_CXX_COMPILER_ID MATCHES ".*GNU.*") - AND WIN32 - ) set(SUPPORTS_ASAN OFF) - else() - set(SUPPORTS_ASAN ON) endif() # ccache, clang-tidy, cppcheck are only supported with Ninja and Makefile based generators