Skip to content

Commit

Permalink
GH-44448: [C++] Add support for overwriting grpc_cpp_plugin path for …
Browse files Browse the repository at this point in the history
…cross-compiling (#44507)

### Rationale for this change

We can't use `find_package(gRPC)` and `gRPC::grpc_cpp_plugin` for cross-compiling because it's for host. We need `grpc_cpp_plugin` for target in cross-compiling.

### What changes are included in this PR?

Add `ARROW_GRPC_CPP_PLUGIN` CMake option that overwrites `gRPC::grpc_cpp_plugin` path found by `find_package(gRPC)`.

### Are these changes tested?

Yes.

conda-forge/arrow-cpp-feedstock#1432

### Are there any user-facing changes?

Yes.
* GitHub Issue: #44448

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
kou authored Oct 23, 2024
1 parent 5ea3aa1 commit 8eccbfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,11 @@ Always OFF if building binaries" OFF)
"Compiler flags to append when pre-compiling Gandiva operations"
"")

#----------------------------------------------------------------------
set_option_category("Cross compiling")

define_option_string(ARROW_GRPC_CPP_PLUGIN "grpc_cpp_plugin path to be used" "")

#----------------------------------------------------------------------
set_option_category("Advanced developer")

Expand Down
8 changes: 8 additions & 0 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4223,6 +4223,14 @@ if(ARROW_WITH_GRPC)
target_link_libraries(gRPC::grpc++ INTERFACE gRPC::grpc_asan_suppressed)
endif()
endif()

if(ARROW_GRPC_CPP_PLUGIN)
if(NOT TARGET gRPC::grpc_cpp_plugin)
add_executable(gRPC::grpc_cpp_plugin IMPORTED)
endif()
set_target_properties(gRPC::grpc_cpp_plugin PROPERTIES IMPORTED_LOCATION
${ARROW_GRPC_CPP_PLUGIN})
endif()
endif()

# ----------------------------------------------------------------------
Expand Down

0 comments on commit 8eccbfe

Please sign in to comment.