add_custom_command( OUTPUT ${PROTO_DIR}/helloworld.pb.cc ${PROTO_DIR}/helloworld.pb.h ${PROTO_DIR}/helloworld.grpc.pb.cc ${PROTO_DIR}/helloworld.grpc.pb.h COMMAND ${protobuf_BINARY_DIR}/protoc ARGS --grpc_out "${PROTO_DIR}" --cpp_out "${PROTO_DIR}" -I "${PROTO_DIR}" --plugin=protoc-gen-grpc=${grpc_BINARY_DIR}/grpc_cpp_plugin helloworld.proto) message("${BoldGreen}add files at ${PROTO_DIR} successfully!${ColourReset}") add_library(test2_grpc STATIC ${PROTO_DIR}/helloworld.pb.cc ${PROTO_DIR}/helloworld.pb.h ${PROTO_DIR}/helloworld.grpc.pb.cc ${PROTO_DIR}/helloworld.grpc.pb.h) target_link_libraries(wenet_proto PUBLIC ${third_party_libraries}) foreach(_target greeter_client greeter_server greeter_async_client greeter_async_client2 greeter_async_server) add_executable(${_target} "${_target}.cc") target_link_libraries(${_target} test2_grpc ${third_party_libraries}) endforeach()