From 5d78d634f2561c15ef2e7f8745a46c481d1260c4 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 1 Aug 2025 08:43:01 +0200 Subject: [PATCH] cmake: disable warnings for operands with different enum types With a recent upgrade to a newer version of MSVC we now get a bunch of warnings when two operands use different enum types. While sensible in theory, in practice we have a couple of non-public enums that extend public enums, like for example with `GIT_SUBMODULE_STATUS`. Let's for now disable this warning to unblock our builds. The alternative would be to add casts all over the place, but that feels rather cumbersome. --- cmake/DefaultCFlags.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/DefaultCFlags.cmake b/cmake/DefaultCFlags.cmake index 25a7f8200..5abe0c8c2 100644 --- a/cmake/DefaultCFlags.cmake +++ b/cmake/DefaultCFlags.cmake @@ -13,6 +13,9 @@ if(MSVC) # /Gd - explicitly set cdecl calling convention set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd") + # Remove warnings about operands that use different enum types. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd5287") + if(NOT (MSVC_VERSION LESS 1900)) # /guard:cf - Enable Control Flow Guard set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")