This is an automated email from the ASF dual-hosted git repository. kou pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push: new 7db7e6ac84 GH-34191: [C++] Ensure using the same ProtoBuf in bundled ORC (#34192) 7db7e6ac84 is described below commit 7db7e6ac846199678e2694f173df6dd6376ee823 Author: Sutou Kouhei <k...@clear-code.com> AuthorDate: Mon Feb 20 11:41:55 2023 +0900 GH-34191: [C++] Ensure using the same ProtoBuf in bundled ORC (#34192) ### Rationale for this change We can't detect correct ProtoBuf related values to pass bundled ORC with the current approach. ### What changes are included in this PR? This change uses generator expression to get `CONFIG` depended value correctly. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #34191 Authored-by: Sutou Kouhei <k...@clear-code.com> Signed-off-by: Sutou Kouhei <k...@clear-code.com> --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 33 ++++++++++++----------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 0b6d98b73c..4d7679f9ab 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1814,7 +1814,11 @@ if(ARROW_WITH_PROTOBUF) # Log protobuf paths as we often see issues with mixed sources for # the libraries and protoc. get_target_property(PROTOBUF_PROTOC_EXECUTABLE ${ARROW_PROTOBUF_PROTOC} - IMPORTED_LOCATION) + IMPORTED_LOCATION_RELEASE) + if(NOT PROTOBUF_PROTOC_EXECUTABLE) + get_target_property(PROTOBUF_PROTOC_EXECUTABLE ${ARROW_PROTOBUF_PROTOC} + IMPORTED_LOCATION) + endif() message(STATUS "Found protoc: ${PROTOBUF_PROTOC_EXECUTABLE}") get_target_property(PROTOBUF_TYPE ${ARROW_PROTOBUF_LIBPROTOBUF} TYPE) if(NOT STREQUAL "INTERFACE_LIBRARY") @@ -4416,14 +4420,9 @@ macro(build_orc) set(ORC_STATIC_LIB "${ORC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}orc${CMAKE_STATIC_LIBRARY_SUFFIX}") - get_target_property(ORC_PROTOBUF_EXECUTABLE ${ARROW_PROTOBUF_PROTOC} IMPORTED_LOCATION) - - get_target_property(ORC_PROTOBUF_INCLUDE_DIR ${ARROW_PROTOBUF_LIBPROTOBUF} + get_target_property(ORC_PROTOBUF_ROOT ${ARROW_PROTOBUF_LIBPROTOBUF} INTERFACE_INCLUDE_DIRECTORIES) - get_filename_component(ORC_PROTOBUF_ROOT "${ORC_PROTOBUF_INCLUDE_DIR}" DIRECTORY) - - get_target_property(ORC_PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF} - IMPORTED_LOCATION) + get_filename_component(ORC_PROTOBUF_ROOT "${ORC_PROTOBUF_ROOT}" DIRECTORY) get_target_property(ORC_SNAPPY_INCLUDE_DIR ${Snappy_TARGET} INTERFACE_INCLUDE_DIRECTORIES) @@ -4435,8 +4434,6 @@ macro(build_orc) get_target_property(ORC_ZSTD_ROOT ${ARROW_ZSTD_LIBZSTD} INTERFACE_INCLUDE_DIRECTORIES) get_filename_component(ORC_ZSTD_ROOT "${ORC_ZSTD_ROOT}" DIRECTORY) - # Weirdly passing in PROTOBUF_LIBRARY for PROTOC_LIBRARY still results in ORC finding - # the protoc library. set(ORC_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${ORC_PREFIX}" @@ -4446,21 +4443,17 @@ macro(build_orc) -DBUILD_TOOLS=OFF -DBUILD_CPP_TESTS=OFF -DINSTALL_VENDORED_LIBS=OFF + "-DLZ4_HOME=${ORC_LZ4_ROOT}" + "-DPROTOBUF_EXECUTABLE=$<TARGET_FILE:${ARROW_PROTOBUF_PROTOC}>" + "-DPROTOBUF_HOME=${ORC_PROTOBUF_ROOT}" + "-DPROTOBUF_INCLUDE_DIR=$<TARGET_PROPERTY:${ARROW_PROTOBUF_LIBPROTOBUF},INTERFACE_INCLUDE_DIRECTORIES>" + "-DPROTOBUF_LIBRARY=$<TARGET_FILE:${ARROW_PROTOBUF_LIBPROTOBUF}>" + "-DPROTOC_LIBRARY=$<TARGET_FILE:${ARROW_PROTOBUF_LIBPROTOC}>" "-DSNAPPY_HOME=${ORC_SNAPPY_ROOT}" "-DSNAPPY_INCLUDE_DIR=${ORC_SNAPPY_INCLUDE_DIR}" - "-DPROTOBUF_EXECUTABLE=${ORC_PROTOBUF_EXECUTABLE}" - "-DPROTOBUF_HOME=${ORC_PROTOBUF_ROOT}" - "-DPROTOBUF_INCLUDE_DIR=${ORC_PROTOBUF_INCLUDE_DIR}" - "-DPROTOBUF_LIBRARY=${ORC_PROTOBUF_LIBRARY}" - "-DPROTOC_LIBRARY=${ORC_PROTOBUF_LIBRARY}" - "-DLZ4_HOME=${ORC_LZ4_ROOT}" "-DZSTD_HOME=${ORC_ZSTD_ROOT}" "-DZSTD_INCLUDE_DIR=$<TARGET_PROPERTY:${ARROW_ZSTD_LIBZSTD},INTERFACE_INCLUDE_DIRECTORIES>" "-DZSTD_LIBRARY=$<TARGET_FILE:${ARROW_ZSTD_LIBZSTD}>") - if(ORC_PROTOBUF_EXECUTABLE) - set(ORC_CMAKE_ARGS ${ORC_CMAKE_ARGS} - "-DPROTOBUF_EXECUTABLE:FILEPATH=${ORC_PROTOBUF_EXECUTABLE}") - endif() if(ZLIB_ROOT) set(ORC_CMAKE_ARGS ${ORC_CMAKE_ARGS} "-DZLIB_HOME=${ZLIB_ROOT}") endif()