Hi !

>From my viewpoint cmake integration is really a pain !

I used the quickstart to build and deploy grpc ... fine ...

Now I want to use it in my project to build proto files.

I used this cmake snippet to build it :

# https://www.f-ax.de/dev/2020/11/08/grpc-plugin-cmake-support.html
find_package(absl CONFIG REQUIRED PATHS /opt/grpc)
find_package(utf8_range CONFIG HINTS /opt/grpc REQUIRED)
find_package(protobuf CONFIG HINTS /opt/grpc REQUIRED)
find_package(gRPC CONFIG REQUIRED PATHS /opt/grpc)
find_package(Threads)

add_library(myproto ${PROTO_FILES})
target_link_libraries(myproto
PUBLIC
protobuf::libprotobuf
gRPC::grpc
gRPC::grpc++
)
target_include_directories(myproto PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

#
# Compile protobuf and grpc files in myproto target to cpp
get_target_property(grpc_cpp_plugin_location gRPC::grpc_cpp_plugin IMPORTED)
message("status cpp plugin ${grpc_cpp_plugin_location}")
protobuf_generate(TARGET myproto LANGUAGE cpp)
protobuf_generate(TARGET myproto LANGUAGE grpc GENERATE_EXTENSIONS 
.grpc.pb.h .grpc.pb.cc PLUGIN "protoc-gen-grpc=${grpc_cpp_plugin_location}")

unfortunately the grpc_cpp_plugin_location variable is equal to TRUE ....

and thus it does not work.

What is the straight way to use cmake with gRPC ??

Regards
Steph

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/8fd511e0-d8c8-4c7a-9231-3b39db5ba1f9n%40googlegroups.com.

Reply via email to