FindProtobuf: Add PLUGIN parameter
Following the protobuf mainline development, this also adds the PLUGIN parameter to the protobuf_generate
function.
This enables, for example, reusing the function for generating gRPC code by specifying which grpc plugin to use, eg.
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin LOCATION)
protobuf_generate(TARGET ${PROJECT_NAME} LANGUAGE cpp)
protobuf_generate(TARGET ${PROJECT_NAME} LANGUAGE grpc GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location}")
This is needed since, for example, all the major Linux distributions don't yet ship Protobuf's mainline cmake module. Packages installed via conan or vcpkg however do already ship the package's cmake module(s).
Topic-rename: FindProtobuf-grpc-plugin
Edited by Brad King