asio-grpc v3.4.0
Asynchronous gRPC with Asio/unified executors
|
In the same directory that called find_package(asio-grpc)
the following CMake function will be made available. It can be used to generate Protobuf/gRPC source files from .proto
schemas.
If you are using cmake-format then you can copy the asio_grpc_protobuf_generate
section from cmake-format.yaml to get proper formatting.
PROTOS: Input .proto
schema files.
OUT_DIR: Generated files output directory. Default: CMAKE_CURRENT_BINARY_DIR
.
OUT_VAR: Variable to define with generated source files.
TARGET: Add generated source files to target.
USAGE_REQUIREMENT: How to add sources to <target>
: PRIVATE
, PUBLIC
, INTERFACE
. Default: PRIVATE
.
IMPORT_DIRS: Import directories to be added to the protoc command line. If unspecified then the directory of each .proto file will be used.
EXTRA_ARGS: Additional protoc command line arguments.
GENERATE_GRPC: Generate gRPC files (.grpc.pb.h and .grpc.pb.cc).
GENERATE_DESCRIPTORS: Generate descriptor files named <proto_file_base_name>.desc
.
GENERATE_MOCK_CODE: Generate gRPC client stub mock files named _mock.grpc.pb.h
.
Given a CMake target called target-option
:
Compiling target-option
will cause the generation and compilation of:
${CMAKE_CURRENT_BINARY_DIR}/target/target.pb.h
${CMAKE_CURRENT_BINARY_DIR}/target/target.pb.cc
${CMAKE_CURRENT_BINARY_DIR}/target/target.grpc.pb.h
${CMAKE_CURRENT_BINARY_DIR}/target/target.grpc.pb.cc
${CMAKE_CURRENT_BINARY_DIR}/target/target_mock.grpc.pb.h
whenever ${CMAKE_CURRENT_SOURCE_DIR}/proto/target.proto
has been modified.