Skip to content

Commit

Permalink
apacheGH-36860: [C++] Report CMake error when system Protobuf exists …
Browse files Browse the repository at this point in the history
…but system gRPC doesn't exist
  • Loading branch information
kou committed Jul 27, 2023
1 parent 5e1c112 commit e216598
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cpp/cmake_modules/FindgRPCAlt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ if(GRPCPP_PC_FOUND)
HINTS ${GRPCPP_PC_PREFIX}
NO_DEFAULT_PATH
PATH_SUFFIXES "bin")
set(gRPCAlt_FIND_PACKAGE_ARGS gRPCAlt REQUIRED_VARS GRPCPP_IMPORTED_LOCATION
GRPC_CPP_PLUGIN)
if(gRPCAlt_VERSION)
list(APPEND gRPCAlt_FIND_PACKAGE_ARGS VERSION_VAR gRPCAlt_VERSION)
endif()
find_package_handle_standard_args(${gRPCAlt_FIND_PACKAGE_ARGS})
endif()
set(gRPCAlt_FIND_PACKAGE_ARGS gRPCAlt REQUIRED_VARS GRPCPP_IMPORTED_LOCATION
GRPC_CPP_PLUGIN)
if(gRPCAlt_VERSION)
list(APPEND gRPCAlt_FIND_PACKAGE_ARGS VERSION_VAR gRPCAlt_VERSION)
endif()
find_package_handle_standard_args(${gRPCAlt_FIND_PACKAGE_ARGS})

if(gRPCAlt_FOUND)
# gRPC does not expose the reflection library via pkg-config, but it should be alongside the main library
get_filename_component(GRPCPP_IMPORTED_DIRECTORY ${GRPCPP_IMPORTED_LOCATION} DIRECTORY)
if(ARROW_GRPC_USE_SHARED)
Expand All @@ -77,11 +79,7 @@ if(GRPCPP_PC_FOUND)
NAMES grpc++_reflection ${GRPCPP_REFLECTION_LIB_NAME}
PATHS ${GRPCPP_IMPORTED_DIRECTORY}
NO_DEFAULT_PATH)
else()
set(gRPCAlt_FOUND FALSE)
endif()

if(gRPCAlt_FOUND)
add_library(gRPC::grpc++ UNKNOWN IMPORTED)
set_target_properties(gRPC::grpc++
PROPERTIES IMPORTED_LOCATION "${GRPCPP_IMPORTED_LOCATION}"
Expand Down

0 comments on commit e216598

Please sign in to comment.