Bazel BUILD files virtual directory structure not understood by CLion
Hello,
Bazel BUILD files provide two tags that modify the include path of a file: "include_prefix" and "strip_include_prefix".
Clion does not seem to understand the latter, as such he always complains about my #include paths and tries to add different ones for me.
Of course, if I add those CLion wishes for me to use, the project won't compile as Bazel will have a problem with them.
I appreciate Clion is mainly based on CMake, but since JB wrote a plugin for Bazel, it would be nice if I could use the full brightness of the search engine when using it.
So my question is: am I doing something wrong, or is this feature not implemented?
Example of the issue:
My project structure:
project/include/dog.hpp
project/BUILD
BUILD content:
cc_library(
name = "doglib"
hdrs = ["include/dog.hpp"]
include_prefix = "animal/land"
strip_include_prefix = "include"
)
If I want to include dog.hpp from another part of my codebase I need to use the following #include or the compiler won't find the header in its include path, because of how Bazel virtual include path works:
#include <animal/land/dog.hpp>
What Clion wants me to use is
#include <animal/land/include/dog.hpp>
请先登录再写评论。
Hi!
Right now CLion doesn't really provide the infrastructure for this kind of plugins, so it is made in a hacky way. Hopefully, in one of the next releases, the technology will be there to rewrite the plugin properly. Nevertheless, you can contact the plugin authors (it is a third-party plugin, not the JetBrains one).
Has the technology released? Is there a way to implement such plugin now?
Any update on this?
Hi everyone!
Indeed there are some issues with Bazel virtual directories in CLion, we will investigate the situation. Please follow https://youtrack.jetbrains.com/issue/CPP-17658 and https://youtrack.jetbrains.com/issue/CPP-17659 to get updates.