protocolbuffers/protobuf

Support maintaining source directory structure at generated location when using protobuf_generate

Open

#17 349 ouverte le 5 juil. 2024

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C++ (16 128 forks)batch import
c++cmakehelp wanted

Métriques du dépôt

Stars
 (71 223 stars)
Métriques de merge PR
 (Merge moyen 2j 11h) (185 PRs mergées en 30 j)

Description

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.

Guide contributeur