From 43dd7544dc98bf30208d6ec0ad6b3a67b288bf53 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Tue, 21 Oct 2025 05:19:43 +0200
Subject: [PATCH] external_include_paths feature: pass /external:W0 to VC++
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If /external:I but not /external:W… is passed, VC++ emits diagnostic D9007 and
ignores the /external:I option,
cf. https://learn.microsoft.com/en-us/cpp/build/reference/external-external-headers-diagnostics?view=msvc-170#arguments.
---
cc/private/toolchain/windows_cc_toolchain_config.bzl | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cc/private/toolchain/windows_cc_toolchain_config.bzl b/cc/private/toolchain/windows_cc_toolchain_config.bzl
index 5d0d40feb..91eb08cbf 100644
--- a/cc/private/toolchain/windows_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/windows_cc_toolchain_config.bzl
@@ -1027,6 +1027,9 @@ def _impl(ctx):
ACTION_NAMES.objcpp_compile,
],
flag_groups = [
+ flag_group(
+ flags = ["/external:W0"],
+ ),
flag_group(
flags = ["/external:I%{external_include_paths}"],
iterate_over = "external_include_paths",