Thanks for the suggestion and sorry for taking so long to reply. It's an
interesting idea but I guess I'm skeptical of whether it's worth the effort
to avoid an extra protoc invocation, since in my experience protoc
invocations are not usually the bottleneck in build performance. I would
also be nervous about adding a special case for gRPC, since that is just
one of many plugins that one might want to use.

On Fri, Feb 24, 2023 at 10:25 AM Li He <[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/protobuf/9d44ccc8-3dd4-42bb-b5bd-f71217c7ba57n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADqAXr7Lr4q3D9v5yYdhyCk%2BT6c44ZPRCJM58ZGJxgOWLGDPvw%40mail.gmail.com.

Reply via email to