summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/option.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index e8f6a4fb8..4969de689 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -375,11 +375,18 @@ end
-- @return true, false, or nil
--
function option.boolean(value)
- if type(value) == "string" then
+ local value_type = type(value)
+ if value_type == "string" then
local v = value:lower()
- if v == "true" or v == "yes" or v == "y" then value = true
- elseif v == "false" or v == "no" or v == "n" then value = false
+ if v == "true" or v == "yes" or v == "y" then
+ value = true
+ elseif v == "false" or v == "no" or v == "n" then
+ value = false
+ else
+ value = nil
end
+ elseif value_type ~= "boolean" then
+ value = nil
end
return value
end