-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Description of the feature request:
C and C++ compiler options are very related, but not always identical, ranging from variations in language specifiers and even warnings flags. For example GCC uses slightly different names for the same warning between C and C++:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-prototypes
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-declarations
Bazel does have --cxxopt and --conlyopt flags, but there is no way to do it from a build file. (A library project cannot control the flags used by upstreams.) It is possible to workaround this by splitting the target in two, but this is messy, particularly in a library project that already needs to support multiple build systems.
Other build tools already have this capability.
https://discourse.cmake.org/t/language-specific-add-compile-options/2643
https://www.gnu.org/software/automake/manual/html_node/Standard-Configuration-Variables.html
https://gn.googlesource.com/gn/+/main/docs/reference.md#var_cflags
Which category does this issue belong to?
C++ Rules
What underlying problem are you trying to solve with this feature?
See above
Which operating system are you running Bazel on?
All
What is the output of bazel info release?
No response
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response