Skip to content

Commit 1229ced

Browse files
authored
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]>
1 parent 8a2ff7c commit 1229ced

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

cpp/cmake_modules/FindBrotliAlt.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if(BrotliAlt_FOUND)
2121
return()
2222
endif()
2323

24-
if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR ARROW_PACKAGE_KIND STREQUAL "conan")
24+
if(ARROW_VCPKG OR ARROW_PACKAGE_KIND STREQUAL "conan")
2525
set(find_package_args "")
2626
if(BrotliAlt_FIND_VERSION)
2727
list(APPEND find_package_args ${BrotliAlt_FIND_VERSION})
@@ -32,14 +32,14 @@ if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR ARROW_PACKAGE_KIND STREQUAL "conan")
3232
if(BrotliAlt_FIND_REQUIRED)
3333
list(APPEND find_package_args REQUIRED)
3434
endif()
35-
if(ARROW_PACKAGE_KIND STREQUAL "vcpkg")
35+
if(ARROW_VCPKG)
3636
find_package(BrotliAlt NAMES unofficial-brotli ${find_package_args})
3737
else()
3838
find_package(BrotliAlt NAMES brotli ${find_package_args})
3939
endif()
4040
set(Brotli_FOUND ${BrotliAlt_FOUND})
4141
if(BrotliAlt_FOUND)
42-
if(ARROW_PACKAGE_KIND STREQUAL "vcpkg")
42+
if(ARROW_VCPKG)
4343
add_library(Brotli::brotlicommon ALIAS unofficial::brotli::brotlicommon)
4444
add_library(Brotli::brotlienc ALIAS unofficial::brotli::brotlienc)
4545
add_library(Brotli::brotlidec ALIAS unofficial::brotli::brotlidec)

cpp/cmake_modules/Findutf8proc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(utf8proc_FOUND)
1919
return()
2020
endif()
2121

22-
if(ARROW_PACKAGE_KIND STREQUAL "vcpkg" OR VCPKG_TOOLCHAIN)
22+
if(ARROW_VCPKG)
2323
set(find_package_args "")
2424
if(utf8proc_FIND_VERSION)
2525
list(APPEND find_package_args ${utf8proc_FIND_VERSION})

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2913,7 +2913,7 @@ endmacro()
29132913

29142914
if(ARROW_WITH_UTF8PROC)
29152915
set(utf8proc_resolve_dependency_args utf8proc PC_PACKAGE_NAMES libutf8proc)
2916-
if(NOT VCPKG_TOOLCHAIN)
2916+
if(NOT ARROW_VCPKG)
29172917
# utf8proc in vcpkg doesn't provide version information:
29182918
# https://github.com/microsoft/vcpkg/issues/39176
29192919
list(APPEND utf8proc_resolve_dependency_args REQUIRED_VERSION "2.2.0")

0 commit comments

Comments
 (0)