diff options
| -rw-r--r-- | xmake/core/project/option.lua | 9 | ||||
| -rw-r--r-- | xmake/core/project/project.lua | 10 |
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 |
