0

I need to generate both generic and grpc services from a proto file, say

  1. set option cc_generic_services to true on Linux, and use a non-grpc implementation, and
  2. set option cc_generic_services to false on Windows, to use grpc services.

Is there any way to set the option from the command line to use one proto file.

I use cmake to manage the project files.

Thanks.

Xiaofeng
  • 532
  • 7
  • 22

1 Answers1

0

Finally, I use configure_file to dynamicly generate the proto files based on whether generic_services is enabled.

In the proto.in, define

option cc_generic_services = @GENERIC_SERVICES@;

Then set GENERIC_SERVICES in the CMakeLists.txt based on whether gRPC is enabled.

Xiaofeng
  • 532
  • 7
  • 22