summaryrefslogtreecommitdiff
path: root/xmake/core/project/option.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-22 00:49:25 +0800
committerruki <[email protected]>2017-03-22 00:49:25 +0800
commitbf31745be93eb690ac14114ee181f30ffbb43275 (patch)
tree7eb99c310a53e1b1bd706a463d795df4b5f3f2a0 /xmake/core/project/option.lua
parentce0b97dd29e0cf29b81f4fbef51b64ad925ffdf4 (diff)
fix check default option
Diffstat (limited to 'xmake/core/project/option.lua')
-rw-r--r--xmake/core/project/option.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index a62b6009a..a26450f24 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -455,25 +455,25 @@ function option:check(force)
-- the option name
local name = self:name()
- -- need check?
- if config.get(name) == nil or force then
+ -- get default value, TODO: enable will be deprecated
+ local default = self:get("default")
+ if default == nil then
+ default = self:get("enable")
+ end
- -- get default value, TODO: enable will be deprecated
- local default = self:get("default")
- if default == nil then
- default = self:get("enable")
- end
-
- -- enable it?
- if default ~= nil and (type(default) ~= "boolean" or default == true) then
+ -- need check? (only force to check the automatical option without the default value)
+ if config.get(name) == nil or (default == nil and force) then
- -- enable this option
- config.set(name, true)
+ -- use it directly if the default value exists
+ if default ~= nil then
+
+ -- save the default value
+ config.set(name, default)
-- save this option to configure
self:save()
- -- check option if the default value not exists
+ -- check option as boolean switch automatically if the default value not exists
elseif default == nil and self:_check_condition() then
-- enable this option