cmake protobuf_generate examples

Signatures

protobuf_generate(
  [TARGET <target>]
  [LANGUAGE <lang>]
  [OUT_VAR <variable>]
  [EXPORT_MACRO <macro>]
  [PROTOC_OUT_DIR <out-dir>]
  [PLUGIN <plugin>]
  [PLUGIN_OPTIONS <plugin-options>]
  [DEPENDENCIES <dependencies>...]
  [PROTOS <proto-files>...]
  [IMPORT_DIRS <dirs>...]
  [APPEND_PATH]
  [GENERATE_EXTENSIONS <extensions>...]
  [PROTOC_OPTIONS <options>...]
  [PROTOC_EXE <executable>]
  [DESCRIPTORS]
)

Examples

zenustech/zeno projects/RPC/cmake/ProtoHelper.cmake :25

PROTOBUF_GENERATE(TARGET ${RANDOM_LIBRARY_NAME} LANGUAGE grpc GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location}")

google/filament third_party/dawn/third_party/protobuf/cmake/tests.cmake :182

protobuf_generate(
        PROTOS ${proto_file}
        LANGUAGE ${generator}
        GENERATE_EXTENSIONS .${generator}.h .${generator}.c
        OUT_VAR pb_generated_files
        IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
        IMPORT_DIRS ${protobuf_SOURCE_DIR}
        PLUGIN protoc-gen-${generator}=$<TARGET_FILE:protobuf::protoc-gen-${generator}>
        DEPENDENCIES $<TARGET_FILE:protobuf::protoc-gen-${generator}>
      )

protocolbuffers/protobuf cmake/tests.cmake :202

protobuf_generate(
        PROTOS ${proto_file}
        LANGUAGE ${generator}
        GENERATE_EXTENSIONS .${generator}.h .${generator}.c
        OUT_VAR pb_generated_files
        IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
        IMPORT_DIRS ${protobuf_SOURCE_DIR}
        PLUGIN protoc-gen-${generator}=$<TARGET_FILE:protobuf::protoc-gen-${generator}>
        DEPENDENCIES $<TARGET_FILE:protobuf::protoc-gen-${generator}>
      )

apple/foundationdb cmake/utils.cmake :104

protobuf_generate(
      TARGET ${target_name}
      LANGUAGE grpc
      PROTOC_OUT_DIR ${protoc_out_dir}
      PLUGIN protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
      GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc
      APPEND_PATH ${out_rel_path}
      PROTOS ${proto_files}
  )