summaryrefslogtreecommitdiff
path: root/xmake/core/base/global.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/base/global.lua')
-rw-r--r--xmake/core/base/global.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/xmake/core/base/global.lua b/xmake/core/base/global.lua
index 823603722..0bced098f 100644
--- a/xmake/core/base/global.lua
+++ b/xmake/core/base/global.lua
@@ -59,20 +59,28 @@ function global.readonly(name)
end
-- set the given configure to the current
-function global.set(name, value, readonly)
+--
+-- @param name the name
+-- @param value the value
+-- @param opt the argument options, .e.g {readonly = false, force = false}
+--
+function global.set(name, value, opt)
-- check
assert(name)
+ -- init options
+ opt = opt or {}
+
-- check readonly
- assert(not global.readonly(name), "cannot set readonly global: " .. name)
+ assert(opt.force or not global.readonly(name), "cannot set readonly global: " .. name)
-- set it
global._CONFIGS = global._CONFIGS or {}
global._CONFIGS[name] = value
-- mark as readonly
- if readonly then
+ if opt.readonly then
global._MODES = global._MODES or {}
global._MODES["__readonly_" .. name] = true
end