Using protobuf well known types from gRPC submodule fetched with CMake FetchContent

248 views
Skip to first unread message

Mark Trolley

unread,
Dec 23, 2022, 8:38:05 AM12/23/22
to grpc.io

The gRPC C++ examples use this common CMake file that has an option to fetch gRPC using CMake FetchContent instead of installing locally. This works for me, except that I can't figure out how to access the well known protobuf types from the protobuf submodule.

For example, I added this to the helloworld.proto example:

import "google/protobuf/empty.proto";

and get:

google/protobuf/empty.proto: File not found. helloworld.proto:17:1: Import "google/protobuf/empty.proto" was not found or had errors. make[2]: *** [helloworld.pb.cc] Error 1 make[1]: *** [CMakeFiles/hw_grpc_proto.dir/all] Error 2 make: *** [all] Error 2

empty.proto is in ./_deps/grpc-src/third_party/protobuf/src/google/protobuf/.

Is there something I can add to the CMake file to have this work?

Reply all
Reply to author
Forward
0 new messages