Skip to content

Feature request: strip_include_prefix #145

@mbravi

Description

@mbravi

strip_include_prefix is currently being ignored by this plugin, with the result that for projects using the feature CLion can't find anything because it expects different #include.
The feature is of interest for projects with a rich directory structure (think boost), as it can be simplified in the dev environment, but still left intact when libraries are installed on the target system.
To clarify the issue let me provide an example:

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>

Effectively the issue is that without strip_include_prefix we either can not create a directory called "include" in our bazel package, but instead must use one with the name of the most external namespace, which means the dir structure of any two packages would be different (which is bad for huge projects), or must accept that the #include path starts with "include" (#include "include/animal/land"), which is weird and not standard beside forcing us to ceate in dev the dir structure we want when the package is installed, which makes for worse navigation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions