summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 8ba375fb3..9a4ca698c 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -166,6 +166,7 @@ function _instance:_load_after()
-- leave the environments of the target packages
os.setenvs(oldenvs)
+ self._LOADED_AFTER = true
return true
end
@@ -1946,8 +1947,9 @@ end
-- get the program and name of the given tool kind
function _instance:tool(toolkind)
- if not self:_is_loaded() then
- os.raise("we cannot get tool(%s) before target(%s) is loaded, maybe it is called on_load() now.", toolkind, self:name())
+ -- we cannot get tool in on_load, because target:toolchains() has been not checked in configuration stage.
+ if not self._LOADED_AFTER then
+ os.raise("we cannot get tool(%s) before target(%s) is loaded, maybe it is called on_load(), please call it in on_config().", toolkind, self:name())
end
return toolchain.tool(self:toolchains(), toolkind, {cachekey = "target_" .. self:name(), plat = self:plat(), arch = self:arch(),
before_get = function()