bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.21k stars 4.06k forks source link

specifying the C++ standard via `--features` #18824

Closed junyer closed 1 year ago

junyer commented 1 year ago

Description of the feature request:

Permit specifying the C++ standard via --features such that, for example, --features=cxx_std_14 specifies C++14 as the C++ standard in the appropriate way for the compiler that gets selected during automatic configuration of the C++ toolchain.

What underlying problem are you trying to solve with this feature?

Currently, specifying the C++ standard is problematic for multiple reasons. First and foremost, it requires specifying the C++ standard in a compiler-specific way (e.g. -std=c++14 or /std:c++14). Second, it's unclear when the --cxxopt flag works and doesn't work, when the BAZEL_CXXOPTS environment variable works and doesn't work et cetera. Third, there's mounting evidence (documented by @Mizux) that none of the ways work consistently and effectively when using Abseil and Protobuf.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 6.2.1

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 master; 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

keith commented 1 year ago

dup of https://github.com/bazelbuild/bazel/issues/16551