My .bazelrc file looks like this:
# GCC 9.3
build:gcc9 --cxxopt=-std=c++2a
build:gcc9 --cxxopt=-Wall
# GCC 11.2
build:gcc11 --cxxopt=-std=c++20
build:gcc11 --cxxopt=-Wall
On Ubuntu 20.04 I use bazel build --config=gcc9 //... to build my workspace. Analogous I use bazel build --config=gcc11 //... to build my workspace on Ubuntu 22.04.
Now I was thinking it would be nice if on Ubuntu 22.04 I could build my application by bazel build //... without specifying the config gcc11. Therefore I changed my .bazelrc file like this:
build --enable_platform_specific_config
# GCC 9.3
build:gcc9 --cxxopt=-std=c++2a
build:gcc9 --cxxopt=-Wall
# GCC 11.2
build:gcc11 --cxxopt=-std=c++20
build:gcc11 --cxxopt=-Wall
build:linux --config=gcc11
Now bazel build //... works on Ubuntu 22.04, but breaks building on Ubuntu 20.04 via bazel build --config=gcc9 //..., complaining that GCC does not recognize c++20.
Is there a way that the gcc9 build ignores the linux config? Can I ignore or override it?