Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify -std=c++11 option in bazel BUILD file?

How to add this option into a target description section?

Thanks.

like image 758
Hind Forsum Avatar asked Feb 13 '19 08:02

Hind Forsum


People also ask

What is build file in Bazel?

A BUILD file contains several different types of instructions for Bazel. The most important type is the build rule, which tells Bazel how to build the desired outputs, such as executable binaries or libraries.

How do you run after Bazel build?

To run Bazel, go to your base workspace directory or any of its subdirectories and type bazel . % bazel help [Bazel release bazel-<version>] Usage: bazel <command> <options> ... Available commands: analyze-profile Analyzes build profile data. aquery Executes a query on the post-analysis action graph.

Where do Bazel build files go?

The Bazel user's build state is located beneath outputRoot/_bazel_$USER . This is called the outputUserRoot directory. Beneath the outputUserRoot directory there is an install directory, and in it is an installBase directory whose name is the MD5 hash of the Bazel installation manifest.

What is Filegroup in Bazel?

Use filegroup to give a convenient name to a collection of targets. These can then be referenced from other rules. Using filegroup is encouraged instead of referencing directories directly.


2 Answers

Add bazel build --cxxopt='-std=c++11' to .bazelrc file.

like image 199
P.W Avatar answered Oct 10 '22 19:10

P.W


export BAZEL_CXXOPTS=-std=c++11

see source

like image 30
CodeFarmer Avatar answered Oct 10 '22 20:10

CodeFarmer