summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-16 20:12:07 +0800
committerGitHub <[email protected]>2026-08-16 20:12:07 +0800
commit0093969683870de4cbce93b6cb5dafa55121f662 (patch)
tree35a691321158afc0a35a0b614860f96993b02356
parent9721317cf822815a48b8b8986212622ea1079788 (diff)
parent5c3c259c547e025dadb1aa488a36aa8a56d4e4aa (diff)
Merge pull request #7709 from xmake-io/runtime
fix clang runtime flags
-rw-r--r--xmake/core/package/package.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 78268351e..2d2720fba 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2529,9 +2529,20 @@ function _instance:_generate_runtime_configs(sourcekind)
self.sourcekinds = function (self)
return sourcekind
end
- configs.cxflags = self:compiler(sourcekind):map_flags("runtime", runtimes, {target = self})
- configs.ldflags = self:linker("binary", sourcekind):map_flags("runtime", runtimes, {target = self})
- configs.shflags = self:linker("shared", sourcekind):map_flags("runtime", runtimes, {target = self})
+ local cxflags = self:compiler(sourcekind):map_flags("runtime", runtimes, {target = self})
+ local ldflags = self:linker("binary", sourcekind):map_flags("runtime", runtimes, {target = self})
+ local shflags = self:linker("shared", sourcekind):map_flags("runtime", runtimes, {target = self})
+
+ -- @note the multi-argument flags must be checked as a whole, e.g. the clang runtime
+ -- flags on windows, `-Xclang --dependent-lib=xxx` would be broken if
+ -- `--dependent-lib=xxx` is checked and dropped separately
+ -- @see https://github.com/xmake-io/xmake/issues/7704
+ local group = function (flags)
+ return flags and #flags > 1 and {table.wrap_lock(flags)} or flags
+ end
+ configs.cxflags = group(cxflags)
+ configs.ldflags = group(ldflags)
+ configs.shflags = group(shflags)
self.sourcekinds = nil
end
return configs