Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions cmake_modules/IcebergThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,33 @@ function(resolve_arrow_dependency)
"https://archive.apache.org/dist/thrift/0.22.0/thrift-0.22.0.tar.gz")
endif()

# FetchContent sets arrow_SOURCE_DIR to the tarball root (SOURCE_SUBDIR is cpp)
# and on CMake < 3.30 project(arrow) only sets it as a cache variable, so the
# normal variable takes precedence and Arrow looks for thirdparty/versions.txt
# outside cpp/ (see CMP0180). Patch Arrow to use ARROW_SOURCE_DIR instead.
# See https://github.com/apache/iceberg-cpp/issues/1028.
# TODO: remove once the upstream Arrow fix is released.
set(ARROW_PATCH_COMMAND)
find_program(PATCH patch)
if(PATCH)
set(ARROW_PATCH_COMMAND ${PATCH} -p1 -i)
else()
find_program(GIT git)
if(GIT)
set(ARROW_PATCH_COMMAND ${GIT} apply)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically the same approach we take at Arrow, I don't think it's true, I've applied with both git apply and patch.

endif()
endif()
if(ARROW_PATCH_COMMAND)
list(APPEND ARROW_PATCH_COMMAND
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/arrow-thirdparty-dir.patch)
endif()

fetchcontent_declare(Arrow
${FC_DECLARE_COMMON_OPTIONS}
URL ${ARROW_SOURCE_URL}
URL_HASH "SHA256=${ICEBERG_ARROW_BUILD_SHA256_CHECKSUM}"
SOURCE_SUBDIR
cpp
FIND_PACKAGE_ARGS
CONFIG)
PATCH_COMMAND ${ARROW_PATCH_COMMAND} SOURCE_SUBDIR cpp
FIND_PACKAGE_ARGS CONFIG)
Comment on lines 257 to +262

fetchcontent_makeavailable(Arrow)

Expand Down
28 changes: 28 additions & 0 deletions cmake_modules/arrow-thirdparty-dir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -365,7 +365,7 @@
# ----------------------------------------------------------------------
# Thirdparty versions, environment variables, source URLs

-set(THIRDPARTY_DIR "${arrow_SOURCE_DIR}/thirdparty")
+set(THIRDPARTY_DIR "${ARROW_SOURCE_DIR}/thirdparty")

add_library(arrow::flatbuffers INTERFACE IMPORTED)
target_include_directories(arrow::flatbuffers
Loading