Document @bazel_tools//tools/cpp:compiler
and provide canonical compiler config_setting
s for each toolchain which Bazel autoconfigures
#14914
Labels
help wanted
Someone outside the Bazel team could own this
P3
We're not considering working on this, but happy to review a PR. (No assignee)
team-Documentation
Documentation improvements that cannot be directly linked to other team labels
team-Rules-CPP
Issues for C++ rules
type: documentation (cleanup)
Description of the problem / feature request:
@bazel_tools//tools/cpp:compiler
is an undocumented target which provides thecompiler
attribute from thecc_toolchain
currently in use. It is a Starlark rule defined here: tools/cpp/compiler_flag.bzlThis feature should be documented and supported for use in
config_setting
targets.Ideally it would be easy to find from here: https://bazel.build/docs/integrating-with-rules-cc
In addition, it would be useful if well-known
config_setting
targets were provided for each value ofcc_toolchain.compiler
in use within the Bazel-provided toolchains.Feature requests: what underlying problem are you trying to solve with this feature?
Due to compiler differences, some flags need to be spelled differently depending on the compiler.
An example is gcc/clang vs. msvc/clang-cl:
When setting the C++ target
std
, gcc/clang expect-std=c++20
whereas msvc/clang-cl expect/std:c++20
.Unfortunately selecting on
@platforms//os:windows
as a target is not sufficient--clang and/or mingw cross compilation would need the former set of flags, despite targeting Windows.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a
cc_library
:bazel build --compiler=mingw-gcc //...:foo_bin
What operating system are you running Bazel on?
Windows
What's the output of
bazel info release
?IDK, current? Issue exists at tip-of-tree.
Have you found anything relevant by searching the web?
#12897
The text was updated successfully, but these errors were encountered: