From d865e9e6e13e03ec0020d9529006a7ac750ca6b2 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 24 Jun 2026 00:36:59 -0300 Subject: [PATCH] fix: exclude clang-cl from MSVC-only compiler guards in CMake clang-cl defines MSVC in CMake, but some guarded blocks apply flags or behavior that are specific to cl.exe and should not be passed to clang-cl. Exclude Clang from those MSVC-only branches so clang-cl follows the compatible compiler path instead of inheriting cl.exe-only settings. --- deps_src/clipper2/CMakeLists.txt | 6 +++++- deps_src/miniz/CMakeLists.txt | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/deps_src/clipper2/CMakeLists.txt b/deps_src/clipper2/CMakeLists.txt index c604002da7..86c9a9efab 100644 --- a/deps_src/clipper2/CMakeLists.txt +++ b/deps_src/clipper2/CMakeLists.txt @@ -37,7 +37,11 @@ target_include_directories(Clipper2 ) if (WIN32) - target_compile_options(Clipper2 PRIVATE /W4 /WX) + if (MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(Clipper2 PRIVATE /W4 /WX) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + target_compile_options(Clipper2 PRIVATE /W4) + endif() else() target_compile_options(Clipper2 PRIVATE -Wall -Wextra -Wpedantic -Werror) target_link_libraries(Clipper2 PUBLIC -lm) diff --git a/deps_src/miniz/CMakeLists.txt b/deps_src/miniz/CMakeLists.txt index e02d8a4885..7e060a180f 100644 --- a/deps_src/miniz/CMakeLists.txt +++ b/deps_src/miniz/CMakeLists.txt @@ -11,6 +11,8 @@ add_library(miniz_static STATIC if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") target_compile_definitions(miniz_static PRIVATE _GNU_SOURCE) +elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + target_compile_options(miniz_static PRIVATE /clang:-Wno-error=incompatible-pointer-types) endif() target_link_libraries(miniz INTERFACE miniz_static)