Reputation: 2749
I'm currently migrating a multipackage C++14 project to Bazel, but whenever I run $ bazel build
on linux I end up getting build errors because Bazel is calling the compiler with -std=c++0x
.
One of the requirements for this project is to gradually migrate its packages to C++17 once the build system is up and running. However, after browsing through Bazel's docs I saw no reference to how to set a project's target C++ standard version. CMake handles this trivially and effortlessly through its CXX_STANDARD
target property, but so far I saw no reference to this usecase being supported by Bazel.
With this in mind, does anyone know if Bazel allows users to specify C++ standard versions for specific projects/workspaces? If it does, is it possible to provide a minimal working example?
Upvotes: 2
Views: 812
Reputation: 1213
Other good way to add custom compiler flags is to wrap cc_{binary,library} into your own macro:
def my_cc_library(
name,
copts=[],
**kwargs):
cc_library(
name = name,
copts = copts + ["-std=c++14"],
**kwargs)
Upvotes: 0