From 16abea821afd15980b8bc18e6a216240c2ae9d17 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 23 Oct 2024 10:30:33 +0900 Subject: [PATCH] GH-44448: [C++] Add support for overriding grpc_cpp_plugin path for cross-compiling --- cpp/cmake_modules/DefineOptions.cmake | 5 +++++ cpp/cmake_modules/ThirdpartyToolchain.cmake | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index d823444cf790f..a7bf9e59f8aa2 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -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") diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index db151b4e0f44b..0b215b5b25c62 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -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() # ----------------------------------------------------------------------