I have a Bazel WORKSPACE
that looks like this:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_gflags_gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2",
urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"],
)
http_archive(
name = "com_github_google_glog",
sha256 = "122fb6b712808ef43fbf80f75c52a21c9760683dae470154f02bddfc61135022",
strip_prefix = "glog-0.6.0",
urls = ["https://github.com/google/glog/archive/v0.6.0.zip"],
)
I can build targets with both gflags and glog just fine, but in order to see my log messages, I have to prefix GLOG_logtostderr=1
in front of my commands, when I expected to be able to use --logtostderr
.
I have found some similar questions out there on the Internet, but I wasn't able to get this working, perhaps because I'm new to Bazel. This looks to be the closest question, but they aren't using http_archive
, so they may have a bit more flexibility? I think my setup is pretty simple (setting up a new project with almost a blank slate), though, so I am hoping for a straightforward, easy solution.
I also tried setting HAVE_LIB_GFLAGS
via a patch to glog, but that didn't seem to work (maybe set them in the wrong places) and I tried adding a defines
attribute to my binary's target (though I'd rather the config be global to my workspace).
Thank you in advance for any ideas.