Building C++ example with grpc++ instead of grpc++_unsecure

The example should be build with grpc++, not grpc++_unsecure.

For some reason in some branches like master, both versions are built in
so problem not detected.  This problem surfaced in 1.28x so needs to be
fixed to link with the correct grpc++.
pull/22400/head
Donna Dionne 5 years ago
parent 2a1deeec2b
commit 48fa247304
  1. 8
      examples/cpp/helloworld/CMakeLists.txt

@ -60,7 +60,7 @@ if(GRPC_AS_SUBMODULE)
else()
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
endif()
set(_GRPC_GRPCPP_UNSECURE grpc++_unsecure)
set(_GRPC_GRPCPP grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
@ -87,7 +87,7 @@ elseif(GRPC_FETCHCONTENT)
set(_PROTOBUF_LIBPROTOBUF libprotobuf)
set(_REFLECTION grpc++_reflection)
set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>)
set(_GRPC_GRPCPP_UNSECURE grpc++_unsecure)
set(_GRPC_GRPCPP grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
@ -116,7 +116,7 @@ else()
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure)
set(_GRPC_GRPCPP gRPC::grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
@ -155,6 +155,6 @@ foreach(_target
${hw_grpc_srcs})
target_link_libraries(${_target}
${_REFLECTION}
${_GRPC_GRPCPP_UNSECURE}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
endforeach()

Loading…
Cancel
Save