diff options
| author | ruki <[email protected]> | 2024-03-23 00:42:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-03-23 00:42:17 +0800 |
| commit | 9d0df4ca022d1f2ee74801c84e4930422a681ba9 (patch) | |
| tree | bdd9ce38d3359b0096938ab5d05dc41c5beb0cf9 | |
| parent | f259e3c8f7d94f872590f1ca743c47095f4723e8 (diff) | |
improve system::find_package
| -rw-r--r-- | xmake/modules/package/manager/system/find_package.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/system/find_package.lua b/xmake/modules/package/manager/system/find_package.lua index 862862d5a..2a7b4727c 100644 --- a/xmake/modules/package/manager/system/find_package.lua +++ b/xmake/modules/package/manager/system/find_package.lua @@ -36,6 +36,17 @@ function _get_package_items() return items end +-- check package toolchains +function _check_package_toolchains(package) + local has_standalone + for _, toolchain_inst in pairs(package:toolchains()) do + if toolchain_inst:check() and toolchain_inst:is_standalone() then + has_standalone = true + end + end + return has_standalone +end + -- find package from system and compiler -- @see https://github.com/xmake-io/xmake/issues/4596 -- @@ -55,6 +66,12 @@ function main(name, opt) end snippet_configs.links = snippet_configs.links or name + -- we need to check package toolchain first + -- https://github.com/xmake-io/xmake/issues/4596#issuecomment-2014528801 + if opt.package and not _check_package_toolchains(opt.package) then + return + end + local snippet_opt = { verbose = opt.verbose, target = opt.package, |
