How to add proto_path to protoc call with nanopb integration #78360
Replies: 2 comments 1 reply
-
BTW, I'm on cmake 3.21. Is the only solution to dump all the files into a single directory? |
Beta Was this translation helpful? Give feedback.
1 reply
-
The solution I chose was to build protobuf from the parent directory with hierarchical descending filenames. The existing code required some updates but they were pretty simple. This method avoided moving the existing protobuf files from their modular folders into a single common folder. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
@pdgendt you might be able to help me with this one as well!
I have some common protobuf message definitions in one directory and in another parallel directory my a.proto includes the comon protobuf file.
I would like to add a --proto_path argument to the invokation of protoc.
directory structure
top/
top/common/common_defs.proto
top/lib/lib.proto #has import "common_defs.proto"
In the CMakeLists.txt within top/lib/ I tried various things such as:
set(PROTOBUF_IMPORT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common)
set(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common)
set(Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common)
set(Protobuf_IMPORT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../common)
set(PROTOBUF_OPTIONS "--proto_path=${CMAKE_CURRENT_SOURCE_DIR}/../common")
include_directories(${Protobuf_INCLUDE_DIRS})
but I couldn't get it to work.
also I tried a relative path in the import, but protoc does not allow that.
Beta Was this translation helpful? Give feedback.
All reactions