summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-12 23:23:44 +0800
committerruki <[email protected]>2026-03-12 23:23:44 +0800
commitdeaf196c40c2a7a6dcb7fe2b3917a79c28c99a66 (patch)
treefde987e1b921ff9ffc61202c6c135f0d352740f5
parent5d8708f4bff9c8ee444817ba09776ac120d0278a (diff)
improve vcpkg/find_package
-rw-r--r--xmake/modules/package/manager/vcpkg/find_package.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua
index 045adf050..531137b29 100644
--- a/xmake/modules/package/manager/vcpkg/find_package.lua
+++ b/xmake/modules/package/manager/vcpkg/find_package.lua
@@ -136,6 +136,13 @@ function _find_package(vcpkg, vcpkgdir, name, opt)
-- get configs
local configs = opt.configs or {}
+ -- extract required features before stripping, e.g. curl[openssl,mbedtls] -> {"openssl", "mbedtls"}
+ local required_features
+ local features_str = name:match("%[(.-)%]")
+ if features_str then
+ required_features = features_str:split(",", {plain = true})
+ end
+
-- fix name, e.g. ffmpeg[x264] as ffmpeg
-- @see https://github.com/xmake-io/xmake/issues/925
name = name:gsub("%[.-%]", "")
@@ -161,6 +168,17 @@ function _find_package(vcpkg, vcpkgdir, name, opt)
return
end
+ -- check that required features are installed
+ -- e.g. curl[mbedtls] should have curl_*_triplet_mbedtls.list in info directory
+ if required_features then
+ for _, feature in ipairs(required_features) do
+ local feature_infofile = find_file(format("%s_*_%s_%s.list", name, triplet, feature), infodirs)
+ if not feature_infofile then
+ return
+ end
+ end
+ end
+
-- find dependency package
local result = nil
local _, dependinfo = try { function () return os.iorunv(vcpkg, {"depend-info", name, "--sort=reverse", "--triplet=" .. triplet}) end }