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 9630caa197 GH-53995: [C++] Fix building Arrow via FetchContent with
older versions of CMake (#54573)
9630caa197 is described below
commit 9630caa1971cf290e11f25b754a7b10abb2b02d2
Author: Raúl Cumplido <[email protected]>
AuthorDate: Thu Oct 29 03:31:04 2026 +0100
GH-53995: [C++] Fix building Arrow via FetchContent with older versions of
CMake (#54573)
### Rationale for this change
For older versions of CMake the variable `arrow_SOURCE_DIR` is overriden by
FetchContent's one because `project(arrow)` sets it as a cache variable while
FetchContent sets a normal variable with precedence. Arrow can't find
`thirdparty/versions.txt` because it is pointing to the tarball root instead of
the cpp subfolder. See policy
https://cmake.org/cmake/help/latest/policy/CMP0180.html
This has been tested and found at Iceberg-cpp here:
- https://github.com/apache/iceberg-cpp/pull/1029
### What changes are included in this PR?
Use `ARROW_SOURCE_DIR` instead of `arrow_SOURCE_DIR` so FetchContent's
`arrow_SOURCE_DIR` does not have precedence.
### Are these changes tested?
Yes locally on the iceberg PR on Ubuntu 24.04.
### Are there any user-facing changes?
No
### Was AI used for this PR?
In accordance to the [AI generation
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
please disclose below whether and how AI was used in this PR.
**PR code and description written by:**
- [x] Human
- [ ] AI
I did use AI to initially find the root cause.
**Reviewed before submission by:**
- [x] Human
- [ ] AI
- [ ] Not reviewed
* GitHub Issue: #53995
Authored-by: Raúl Cumplido <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 12e8ba3d82..40343415b3 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -371,7 +371,7 @@ endmacro()
# ----------------------------------------------------------------------
# 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