summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-07 22:30:49 +0800
committerruki <[email protected]>2022-01-07 22:30:49 +0800
commit704332f0dbb224ed4ef0fb6d4096e5eaf9f3e47b (patch)
tree8858b5cca5a364b97b72da041c7f52b3a00bf9b6 /xmake/core/project/target.lua
parenta4943a509a8534cf1372b95162efd31fe532a8e5 (diff)
improve c++ modules
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()