summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-26 22:47:51 +0800
committerruki <[email protected]>2020-10-26 22:47:51 +0800
commitfa86786f0680ca5c5c49a8160163fe41fd9fbec5 (patch)
tree81c9fe89938a3d1142070eb63089ddf8a8c59004 /xmake/core/project/project.lua
parent627995a780821397db57702b6028f624b5aa3b58 (diff)
fix menuconf bug
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 33d8d4233..b7f76300f 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -346,6 +346,11 @@ end
-- load targets
function project._load_targets()
+ -- mark targets have been loaded even if it may fail to load.
+ -- because once loaded, there will be some cached state, such as options,
+ -- so if we load it a second time, there will be some hidden state inconsistencies.
+ project._TARGETS_LOADED = true
+
-- load all requires first and reload the project file to ensure has_package() works for targets
local requires = project.requires()
local ok, errors = project._load(true)
@@ -886,6 +891,11 @@ function project.clear()
project._OPTIONS = nil
end
+-- project has been loaded?
+function project.is_loaded()
+ return project._TARGETS_LOADED
+end
+
-- get the given target
function project.target(name)
return project.targets()[name]