Skip to content

Support maintaining source directory structure at generated location when using protobuf_generate #17349

Open
@clauderobi

Description

@clauderobi

What language does this apply to?
C++ but I suspect is it the same for all.

Describe the problem you are trying to solve.
I use protobuf_generate to generate the .pb.h and .pb.cc. They are generated but they appear all in the same directory location loosing the original directory structure. In other words, the output is a flat directory.

Now, this happens because I need to set multiple paths with IMPORT_DIRS so that the import statements in my .proto files succeed at finding the other source files. This works perfectly and is in line with the fact that the variable is indeed IMPORT_DIRS and not IMPORT_DIR. It is also in line with the fact that the name starts with IMPORT, implying that it relates to the IMPORT statement in the proto files.

However, it appears that protobuf_generate overloads the definition of IMPORT_DIRS with an alternate use by using it as a ROOT directory in order to maintain the directory structure.

Describe the solution you'd like
Use a discrete SRC_ROOT to specify the source base location.

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