So I've spent the best part of a day bashing my head against the wall and wishing I hadn't left the comfort of Makefiles.
Anyway, I'm trying to compile a cc_binary that depends on some files within my directory tree. But for the life of me cannot work out how to set up the include paths such that I can compile my app.
I have a tree that looks something like:
I've tried a few things including trying to use filegroups, various versions of cc_library's and other things. What I have currently as a last resort is a BUILD file that looks like:
name = "my_app",
srcs = ["some/path/to/my_app.cc"],
deps = [":my_lib"],
name = "my_lib",
srcs = glob(["my/lib/path/*.cc"]),
hdrs = glob(["my/lib/path/*.h"]),
includes = ["my/lib/path"]
My source files do a #include "my_lib.h" and I've been reading that unless you use cc_library.includes, cc_library.strip_include_prefix or pass in an include path to cc_library.copts, then the path won't be found. I managed to prove this for myself using a simple helloworld app but can't get it to work with the above.
What trick am I missing?
I've addition to the includes above I've tried both the strip_include_prefix arg and trying to pass in a -Imy/lib/path to copts.
When using cc_library.includes, I can see the full command line has a "-isystem my/lib/path" option which is what the documentation states. Shouldn't this be turned into the relevant -I path?