summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-05 00:35:04 +0800
committerruki <[email protected]>2021-05-05 00:35:04 +0800
commit047625ac3c6cbe1d69cb41b0daaf7bc333d917ed (patch)
tree9766c4d3baed4bb1a725bc2e2552ac1bec457505
parent2643e14e4dc294f4719963bdcb61ab12eac28161 (diff)
fix toplevel for package
-rw-r--r--xmake/core/package/package.lua3
-rw-r--r--xmake/modules/private/action/require/impl/package.lua1
2 files changed, 3 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 8ef9e5884..b96db2849 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -359,7 +359,8 @@ end
-- is top level? user top requires in xmake.lua
function _instance:is_toplevel()
- return not self:parents()
+ local requireinfo = self:requireinfo()
+ return requireinfo and requireinfo.is_toplevel
end
-- is the system package?
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index bbf5bc913..8b29a83d7 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -352,6 +352,7 @@ function _init_requireinfo(requireinfo, package, opt)
-- pass root toolchains to top library package
requireinfo.configs = requireinfo.configs or {}
if opt.is_toplevel then
+ requireinfo.is_toplevel = true
if package:is_cross() and package:is_library() then
-- TODO get extra configs of toolchain
requireinfo.configs.toolchains = requireinfo.configs.toolchains or project.get("target.toolchains") or get_config("toolchain")