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 1229ceddd5 GH-46084: [C++] Always use ARROW_VCPKG to detect vcpkg mode
(#46467)
1229ceddd5 is described below
commit 1229ceddd512aa5b3a601019ee3b4bae28cfa3e6
Author: Sutou Kouhei <[email protected]>
AuthorDate: Mon May 19 11:08:43 2025 +0900
GH-46084: [C++] Always use ARROW_VCPKG to detect vcpkg mode (#46467)
### Rationale for this change
We can use `ARROW_DEPENDENCY_SOURCE=VCPKG` to use vcpkg for dependencies.
We prepare vcpkg by `cpp/cmake_modules/UseVcpkg.cmake` and it always defines
`ARROW_VCPKG`.
The current code base has some ways to detect vcpkg mode:
* `if (ARROW_PACKAGE_KIND STREQUAL "vcpkg")`
* `if (VCPKG_TOOLCHAIN)`
`ARROW_PACKAGE_KIND` is optional. `ARROW_DEPENDENCY_SOURCE=VCPKG` doesn't
define `ARROW_PACKAGE_KIND=vcpkg` automatically.
So either `ARROW_VCPKG` or `VCPKG_TOOLCHAIN` is better to detect vcpkg mode.
### What changes are included in this PR?
This change uses `ARROW_VCPKG` for readability. If we accept vcpkg mode
without `ARROW_DEPENDENCY_SOURCE=VCPKG`, `VCPKG_TOOLCHAIN` is better than
`ARROW_VCPKG`.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
Yes.
* GitHub Issue: #46084
Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
cpp/cmake_modules/FindBrotliAlt.cmake | 6 +++---
cpp/cmake_modules/Findutf8proc.cmake | 2 +-
cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cpp/cmake_modules/FindBrotliAlt.cmake
b/cpp/cmake_modules/FindBrotliAlt.cmake
index 3c90329be9..aa74956648 100644
--- a/cpp/cmake_modules/FindBrotliAlt.cmake
+++ b/cpp/cmake_modules/FindBrotliAlt.cmake
@@ -21,7 +21,7 @@ if(BrotliAlt_FOUND)
return()
endif()
-if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR ARROW_PACKAGE_KIND STREQUAL "conan")
+if(ARROW_VCPKG OR ARROW_PACKAGE_KIND STREQUAL "conan")
set(find_package_args "")
if(BrotliAlt_FIND_VERSION)
list(APPEND find_package_args ${BrotliAlt_FIND_VERSION})
@@ -32,14 +32,14 @@ if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR
ARROW_PACKAGE_KIND STREQUAL "conan")
if(BrotliAlt_FIND_REQUIRED)
list(APPEND find_package_args REQUIRED)
endif()
- if(ARROW_PACKAGE_KIND STREQUAL "vcpkg")
+ if(ARROW_VCPKG)
find_package(BrotliAlt NAMES unofficial-brotli ${find_package_args})
else()
find_package(BrotliAlt NAMES brotli ${find_package_args})
endif()
set(Brotli_FOUND ${BrotliAlt_FOUND})
if(BrotliAlt_FOUND)
- if(ARROW_PACKAGE_KIND STREQUAL "vcpkg")
+ if(ARROW_VCPKG)
add_library(Brotli::brotlicommon ALIAS unofficial::brotli::brotlicommon)
add_library(Brotli::brotlienc ALIAS unofficial::brotli::brotlienc)
add_library(Brotli::brotlidec ALIAS unofficial::brotli::brotlidec)
diff --git a/cpp/cmake_modules/Findutf8proc.cmake
b/cpp/cmake_modules/Findutf8proc.cmake
index 9721f76f06..75d459d0ec 100644
--- a/cpp/cmake_modules/Findutf8proc.cmake
+++ b/cpp/cmake_modules/Findutf8proc.cmake
@@ -19,7 +19,7 @@ if(utf8proc_FOUND)
return()
endif()
-if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR VCPKG_TOOLCHAIN)
+if(ARROW_VCPKG)
set(find_package_args "")
if(utf8proc_FIND_VERSION)
list(APPEND find_package_args ${utf8proc_FIND_VERSION})
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 633f0a0d07..e312ea4ad8 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -2913,7 +2913,7 @@ endmacro()
if(ARROW_WITH_UTF8PROC)
set(utf8proc_resolve_dependency_args utf8proc PC_PACKAGE_NAMES libutf8proc)
- if(NOT VCPKG_TOOLCHAIN)
+ if(NOT ARROW_VCPKG)
# utf8proc in vcpkg doesn't provide version information:
# https://github.com/microsoft/vcpkg/issues/39176
list(APPEND utf8proc_resolve_dependency_args REQUIRED_VERSION "2.2.0")