diff --git a/cpp/cmake_modules/orc.diff b/cpp/cmake_modules/orc.diff index 3ee1f64aeb170..a4b0557847d88 100644 --- a/cpp/cmake_modules/orc.diff +++ b/cpp/cmake_modules/orc.diff @@ -16,24 +16,25 @@ # under the License. diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake -index aa520ff..01ab294 100644 +index aa520ff..7bd75d1 100644 --- a/cmake_modules/ThirdpartyToolchain.cmake +++ b/cmake_modules/ThirdpartyToolchain.cmake -@@ -464,7 +464,7 @@ add_library (orc::protoc ALIAS orc_protoc) - - if (ORC_PACKAGE_KIND STREQUAL "conan") - target_link_libraries (orc_protobuf INTERFACE ${protobuf_LIBRARIES}) --elseif (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOBUF_STATIC_LIB}) -+elseif (ORC_PREFER_STATIC_PROTOBUF AND PROTOBUF_STATIC_LIB) - target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_STATIC_LIB}) +@@ -416,6 +416,18 @@ endif () + if (NOT "${PROTOBUF_HOME}" STREQUAL "" OR ORC_PACKAGE_KIND STREQUAL "conan") + find_package (Protobuf REQUIRED) + set(PROTOBUF_VENDORED FALSE) ++ if (Protobuf_FOUND AND NOT PROTOBUF_STATIC_LIB) ++ get_target_property (target_type protobuf::libprotobuf TYPE) ++ if (target_type STREQUAL "STATIC_LIBRARY") ++ set(PROTOBUF_STATIC_LIB protobuf::libprotobuf) ++ endif () ++ endif() ++ if (Protobuf_FOUND AND NOT PROTOC_STATIC_LIB) ++ get_target_property (target_type protobuf::libprotoc TYPE) ++ if (target_type STREQUAL "STATIC_LIBRARY") ++ set (PROTOC_STATIC_LIB protobuf::libprotoc) ++ endif () ++ endif() else () - target_link_libraries (orc_protobuf INTERFACE ${PROTOBUF_LIBRARY}) -@@ -476,7 +476,7 @@ else () - endif () - - if (NOT ORC_PACKAGE_KIND STREQUAL "conan") -- if (ORC_PREFER_STATIC_PROTOBUF AND ${PROTOC_STATIC_LIB}) -+ if (ORC_PREFER_STATIC_PROTOBUF AND PROTOC_STATIC_LIB) - target_link_libraries (orc_protoc INTERFACE ${PROTOC_STATIC_LIB}) - else () - target_link_libraries (orc_protoc INTERFACE ${PROTOC_LIBRARY}) + set(PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install") + set(PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include")