How to add "local" includes when use bzlmod #20433
-
How to add "local" includes when use bzlmod Consider we are writing the cc_library for a library In the document of cc_library, we can find an explanation of the includes parameter
It seems that "-I" flags should be used when we want to add a search path that only takes effect when compiling this cc_library. So if we use the relative path to the root of this library in the -I flag, e.g.
This option will not work when using bzlmod and this library deps by other code, because the library may layout in the sandbox like
Since most make variables only return path of files, it's hard to get the correct path of the lib. I have try
But it seems like bazel does not allow bash commands to be executed at this location So my question is, what is the best way to handle this problem? If there is no good solution for the time being, is it recommended to use the includes field directly? How will this be handled in the future, adding a local_includes parameter? Or add new make variables? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
See #15553 (comment), you can use this workaround to get the canonical repo name. |
Beta Was this translation helpful? Give feedback.
See #15553 (comment), you can use this workaround to get the canonical repo name.