summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 40ae3a74f..e47463a89 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -875,6 +875,7 @@ end
-- get targets
function project.targets()
+ local loading = false
local targets = project._memcache():get("targets")
if not targets then
local errors
@@ -883,6 +884,18 @@ function project.targets()
os.raise(errors)
end
project._memcache():set("targets", targets)
+ loading = true
+ end
+ if loading then
+ -- do after_load() for targets
+ -- @note we must call it after finishing to cache targets
+ -- because we maybe will call project.targets() in after_load, we need avoid dead recursion loop
+ for _, t in ipairs(project.ordertargets()) do
+ local ok, errors = t:_load_after()
+ if not ok then
+ os.raise(errors or string.format("load target %s failed", t:name()))
+ end
+ end
end
return targets
end