Hi protobuf community members,

I had an idea about some improvements for the protobuf cmake file 
<https://github.com/protocolbuffers/protobuf/blob/v22.0/cmake/protobuf-generate.cmake>.
 
It was discussed over a recent merge request 
<https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8215#note_1323017>. 
I agree with Brad King's comment about moving this to the upstream code 
base but before I send it out, just want to get a sense whether I am on the 
right track. Right now, the function generate_protobuf is intended to be 
used like this:

protobuf_generate(
  OUT_VAR helloworld_proto
  PROTOS helloworld.proto
  LANGUAGE cpp
)
protobuf_generate(
  OUT_VAR helloworld_grpc
  PROTOS helloworld.proto
  LANGUAGE grpc
  PLUGIN "protoc-gen-grpc=${_GRPC_CPP_PLUGIN_EXECUTABLE}"
  GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
)

It seems for each grpc proto file, we will need two calls, so I want to 
make it also support

protobuf_generate(
  OUT_VAR helloworld_proto
  PLUGIN_OUT_VAR helloworld_gprc
  PROTOS helloworld.proto
  LANGUAGE cpp
  PLUGIN "protoc-gen-grpc=${_GRPC_CPP_PLUGIN_EXECUTABLE}"
  GENERATE_EXTENSIONS .pb.h .pb.cc .grpc.pb.h .grpc.pb.cc
)

Let me know if this would be a good change to make and I am happy to send 
out a pull request.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/9d44ccc8-3dd4-42bb-b5bd-f71217c7ba57n%40googlegroups.com.

Reply via email to