diff options
| author | ruki <[email protected]> | 2015-06-05 11:20:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-05 11:20:58 +0800 |
| commit | 4fd209354ecf8a6f90b5a19a18e2268e3c9d649f (patch) | |
| tree | d2a8ee6f98686abfc14259ca6dee7ab736551c9f /xmake/scripts/base/config.lua | |
| parent | 12ce7dea3c7a74f77e9792236cb85bab4fd001e4 (diff) | |
fix some bug for config
Diffstat (limited to 'xmake/scripts/base/config.lua')
| -rw-r--r-- | xmake/scripts/base/config.lua | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua index 8ec455de3..cb9f269c2 100644 --- a/xmake/scripts/base/config.lua +++ b/xmake/scripts/base/config.lua @@ -374,8 +374,18 @@ function config.loadxconf() local name = options.target or options._DEFAULTS.target assert(name and type(name) == "string") - -- init configs - config._CONFIGS = config._CONFIGS or {} + -- init configs if not exists + if not config._CONFIGS then + -- clear configs and mark as "rebuild" + config._CONFIGS = { __rebuild = true } + + -- mark as "reconfig" if the current action is not "config" + if options._ACTION ~= "config" then + config._RECONFIG = true + end + end + + -- the configs local configs = config._CONFIGS -- mark as "rebuild" if clean the cached configure @@ -394,21 +404,26 @@ function config.loadxconf() assert(target and type(target) == "table") -- merge xmake._OPTIONS to target - for k, v in pairs(options) do + if options._ACTION == "config" then + for k, v in pairs(options) do - -- check - assert(type(k) == "string") + -- check + assert(type(k) == "string") - -- skip some options - if not k:startswith("_") and config._need(k) then + -- skip some options + if not k:startswith("_") and config._need(k) then - -- save the option to the target - target[k] = v + -- save the option to the target + target[k] = v + end end end -- merge the default configure options to target - local defaults = option.defaults("config") + local defaults = nil + if config._RECONFIG then defaults = option.defaults("config") + elseif options._ACTION == "config" then defaults = options._DEFAULTS + end if defaults then for k, v in pairs(defaults) do |
