I am having difficulty with the protobuf_generate of FindProtobuf.cmake
in my project
.
├── a
│ ├── b
│ │ ├── c
│ │ │ ├── CMakeLists.txt
│ │ │ └── d.proto
├── e
│ ├── f
│ │ ├── g
│ │ │ ├── CMakeLists.txt
│ │ │ └── h.proto
where a/b/c/CMakeLists.txt
has the following protobuf_generate call:
protobuf_generate(
TARGET d_tgt
PROTOC_OUT_DIR ${CMAKE_BINARY_DIR}
PROTOS d.proto
IMPORT_DIRS ${CMAKE_SOURCE_DIR}
)
Note that the APPEND_PATH flag is not set
and d.proto contains the include:
import "e/f/g/h.proto";
and the generated protoc call
cd ${CMAKE_BINARY_DIR}/a/b/c && protoc --cpp_out :${CMAKE_BINARY_DIR} -I ${CMAKE_SOURCE_DIR}/a/b/c -I ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/a/b/c/d.proto
The inclusion of -I ${CMAKE_SOURCE_DIR}/a/b/c as it makes protoc think that module needs descriptor_table_ name of only d, when the linkage in e/f/g/h is expecting an a/b/c/d name.
If the APPEND_PATH flag is not included no additional paths should be included in the invocation of protoc
In the current flow of FindProtobuf.cmake whether the APPEND_PATH flag is set or not, additional include flags get included
Related to: