Including files from a subdirectory of genfiles

53 views
Skip to first unread message

rodr...@google.com

unread,
Aug 31, 2017, 12:09:19 PM8/31/17
to bazel-discuss
In trying to fix gflags/gflags#233, I ran into the issue that setting copts = ["-I$(GENDIR)/gflags_internal"] doesn't work when the repository is external. For external repos, it needs to be $(GENDIR/external/com_github_gflags_gflags/gflags_internal).

I came up with a relatively messy fix:

if native.repository_name() != "@":
gendir = "$(GENDIR)/external/" + native.repository_name().lstrip("@")
else:
gendir = "$(GENDIR)"
copts = ["-I" + gendir + "/gflags_internal"]

I tried to clean it up with "-I$$(dirname $(location gflags_internal/config.h))" but it seems that shell expansion is not supported in copts.

Can anyone think of a better way of doing this?

rodr...@google.com

unread,
Aug 31, 2017, 12:09:53 PM8/31/17
to bazel-discuss, rodr...@google.com
On Thursday, August 31, 2017 at 6:09:19 PM UTC+2, rodr...@google.com wrote:
> In trying to fix gflags/gflags#233

Link to the issue: https://github.com/gflags/gflags/issues/233

Marcel Hlopko

unread,
Sep 1, 2017, 4:16:11 AM9/1/17
to rodr...@google.com, bazel-discuss
Hmm it might be a bazel bug, I created https://github.com/bazelbuild/bazel/issues/3660 to track the issue on the bazel side, I'll investigate and came back smarter. Not today, but hopefully in O(days).

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/02c3e97e-1c0e-4af4-8dbc-cf7c70e14a5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 
Marcel Hlopko | Software Engineer | hlo...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891
Reply all
Reply to author
Forward
0 new messages