summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2022-01-14 09:15:19 -0300
committerÂngelo Andrade Cirino <[email protected]>2022-01-14 09:15:19 -0300
commit274244bf3530a77ab3c93309e5ea5bb5d29907ae (patch)
treec77ea18ad77df218272b0d63089e121e433e1457 /xmake/core
parented0c0c5e0249aa966ea7061b30710abdd0b09d87 (diff)
parentedcbcd5127a9f3b7bbe93d34aa1921856db9a8fb (diff)
Merge branch 'master' of https://github.com/xmake-io/xmake into modnamefix
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/project/option.lua9
-rw-r--r--xmake/core/project/project.lua10
2 files changed, 12 insertions, 7 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 0364b3b47..40fd43f1a 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -414,13 +414,13 @@ function _instance:add(name, ...)
self:_invalidate()
end
--- remove the value to the option info
+-- remove the value to the option info (deprecated)
function _instance:del(name, ...)
self._INFO:apival_del(name, ...)
self:_invalidate()
end
--- remove the value to the option info (deprecated)
+-- remove the value to the option info
function _instance:remove(name, ...)
self._INFO:apival_remove(name, ...)
self:_invalidate()
@@ -454,6 +454,11 @@ function _instance:name()
return self._NAME
end
+-- get the option description
+function _instance:description()
+ return self:get("description") or ("The " .. self:name() .. " option")
+end
+
-- get the cache key
function _instance:cachekey()
return string.format("%s_%d", tostring(self), self._CACHEID)
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 3aee363a3..cd5171599 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -1161,15 +1161,15 @@ function project.menu()
-- append it
local longname = name
- local descriptions = opt:get("description")
- if descriptions then
+ local description = opt:description()
+ if description then
-- define menu option
- local menu_options = {nil, longname, "kv", default, descriptions}
+ local menu_options = {nil, longname, "kv", default, description}
-- handle set_description("xx", "xx")
- if type(descriptions) == "table" then
- for i, description in ipairs(descriptions) do
+ if type(description) == "table" then
+ for i, description in ipairs(description) do
menu_options[4 + i] = description
end
end