diff options
| author | ruki <[email protected]> | 2026-05-27 09:58:42 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-05-27 09:58:42 +0800 |
| commit | f38aacc87fd1a94fb39755c9f74b8ba143e5dd7d (patch) | |
| tree | 2141a7c8cb7dda763907b3f871fc71d106503875 | |
| parent | 9434c5acbe43352e5331771842245f851f14d316 (diff) | |
Refactor argv handling in find_package.lua
| -rw-r--r-- | xmake/modules/package/manager/vcpkg/find_package.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index 91e27fa3d..5b515d8a2 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -213,20 +213,19 @@ function _find_package(vcpkg, vcpkgdir, name, opt) depend_name = name .. "[" .. table.concat(required_features, ",") .. "]" end local result = nil - -- pre https://github.com/microsoft/vcpkg-tool/pull/1909 - local argv_old = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} - -- post https://github.com/microsoft/vcpkg-tool/pull/1909 - local argv_new = {"depend-info", "--sort=reverse", "--triplet=" .. triplet} + local argv = {"depend-info", depend_name, "--sort=reverse", "--triplet=" .. triplet} -- pass feature flags to depend-info when in manifest mode, otherwise depend-info will not show the complete dependency tree with features if manifest_mode then - table.insert(argv_old, 1, "--feature-flags=versions") - table.insert(argv_new, 1, "--feature-flags=versions") + table.insert(argv, 1, "--feature-flags=versions") end - local _, dependinfo = try { function () return os.iorunv(vcpkg, argv_old, manifest_mode and {curdir = opt.installdir} or nil) end } + local _, dependinfo = try { function () return os.iorunv(vcpkg, argv, manifest_mode and {curdir = opt.installdir} or nil) end } if manifest_mode and not dependinfo then - _, dependinfo = try { function () return os.iorunv(vcpkg, argv_new, manifest_mode and {curdir = opt.installdir} or nil) end } + -- fallback: newer vcpkg-tool no longer accepts the package name as a positional argument, + -- drop it and retry. see https://github.com/microsoft/vcpkg-tool/pull/1909 + table.remove(argv, 3) + _, dependinfo = try { function () return os.iorunv(vcpkg, argv, {curdir = opt.installdir}) end } end if dependinfo then for _, line in ipairs(dependinfo:split("\n", {plain = true})) do |
