I have a file my.proto and I want to create the corresponding my_pb2.py and my_pb2_grpc.py files using cmake. (Unfortunately, I cannot use other build system)
Normally, I use protoc from grpcio-tools python module to do so:
python3 -m grpc_tools.protoc -I. --grpc_python_out=. --python_out=. my.proto
cmake has some support for python protobuf, but implementing it is not clear for my use case.
My questions are:
- how to invoke a similar command in cmake
- how to put the generated file in a specific destination
- what are the required dependencies before running cmake (grpcio-tools/protobuf)?
add_custom_command. "what are the required dependencies before running cmake" - The requirements are the same as ones for the command line you show.