-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you have an cpp example that shows #include headers from other directories? #32
Comments
My ###Case 1 If you have one BUILD file in
If you have two BUILD files, one in
###Case 2 You can include more than one header,
|
From the Build Encyclopedia section on
Thus, in your case, you should do the following: In cc_library(
name = "bar",
srcs = ["bar.cpp"],
hdrs = ["bar.h"],
) And then in #include "barpath/bar.h"
... And then define the build rule under cc_library(
name = "foo",
srcs = ["foo.cpp"],
hdrs = ["foo.h"],
deps = ["//barpath:bar"],
) Basically, use |
For the case where you have Under cc_library(
name = "baz",
srcs = ["baz.cpp"],
hdrs = ["baz.h"],
deps = [...],
) Under cc_library(
name = "bar",
srcs = ["bar.cpp"],
hdrs = ["bar.h"],
deps = [
"//bazpath:baz",
...
],
) And finally, under cc_library(
name = "foo",
srcs = ["foo.cpp"],
hdrs = ["foo.h"],
deps = [
"//barpath:bar",
],
) |
I haven't found a documentation label but we should have such an example |
Case 1:
foopath/foo.cpp needs to include barpath/bar.h
How do I describe the dependency here?
Case 2:
What about second level header file inclusion? For example
foopath/foo.cpp needs to include barpath/bar.h, which includes bazpath/baz.h
The text was updated successfully, but these errors were encountered: