When enabling a CI build using clang-cl.exe, I found that I needed to suppress a warning, but couldn't work out how to do this in the BUILD file.
I added a config_setting() and select() that should pick up the clang-cl configuration and pass -Wno-macro-redefined, but the flag is not passed to clang-cl.exe.
config_setting(
name = "windows-clang-cl",
constraint_values = [
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)
cc_library(
[...]
copts =
select({
# this should be used:
":windows-clang-cl": common_copts + windows_only_copts + ["-Wno-macro-redefined"],
# but this is actually used:
"@bazel_tools//src/conditions:windows": common_copts + windows_only_copts,
}),
)
Links: commit, buildkite log. I'm using --incompatible_enable_cc_toolchain_resolution as recommended by the docs.
I believe that :windows-clang-cl is a strict subset of @bazel_tools//src/conditions:windows so I don't see why that branch of the select() is being ignored. What am I missing?