summaryrefslogtreecommitdiff
path: root/xmake/modules/private/action/require/impl/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-23 22:43:58 +0800
committerruki <[email protected]>2024-01-25 12:09:58 +0800
commita053cf76793f0b0ce3da1d709a0d10db4ec45a30 (patch)
tree104232db560e23810e57f78722871e44306a5e13 /xmake/modules/private/action/require/impl/package.lua
parent0b4aa5644e51a62aa69e8d41f81b48629910a5c2 (diff)
improve package runtime type
Diffstat (limited to 'xmake/modules/private/action/require/impl/package.lua')
-rw-r--r--xmake/modules/private/action/require/impl/package.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index c46a62025..cd61404d0 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -356,14 +356,13 @@ function _add_package_configurations(package)
if package:extraconf("configs", "runtimes", "default") == nil then
local values = {"MT", "MTd", "MD", "MDd",
"c++_static", "c++_shared", "stdc++_static", "stdc++_shared"}
- package:add("configs", "runtimes", {builtin = true, description = "Set the compiler runtimes.", values = values, restrict = function (value)
+ package:add("configs", "runtimes", {builtin = true, description = "Set the compiler runtimes.", type = "string", values = values, restrict = function (value)
local values_set = hashset.from(values)
- if type(value) == "string" then
- if not values_set:has(value) then
- return false
- end
- elseif type(value) == "table" then
- for _, item in ipairs(value) do
+ if type(value) ~= "string" then
+ return false
+ end
+ if value then
+ for _, item in ipairs(value:split(",", {plain = true})) do
if not values_set:has(item) then
return false
end
@@ -539,6 +538,9 @@ function _init_requireinfo(requireinfo, package, opt)
if project.policy("package.inherit_external_configs") then
requireinfo.configs.runtimes = requireinfo.configs.runtimes or get_config("runtimes") or get_config("vs_runtime")
end
+ if type(requireinfo.configs.runtimes) == "table" then
+ requireinfo.configs.runtimes = table.concat(requireinfo.configs.runtimes, ",")
+ end
if requireinfo.configs.lto == nil then
requireinfo.configs.lto = project.policy("build.optimization.lto")
end