Hi,
Can some please help show a better way to export an env var and use in bazel build files?
Here is one way I found, but I want to avoid passing an extra option to bazel command and use some env variable from shell.
bazel build //:sometarget --define MY_VAR_EXTRA_INCS=`pwd`/../../include
# Note that the above path is not within the bazel project scope, so I don't want to copy include to bazel project workspace.
cc_binary (
name = "sometarget",
includes = ["$(MY_VAR_EXTRA_INCS)", "third_party/xyz/include"],
...
)
I simply want to set env variable in shell and run bazel build //:sometarget
Thanks in advance,
Kaustubh