diff options
| author | ruki <[email protected]> | 2026-08-16 20:12:07 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-08-16 20:12:07 +0800 |
| commit | 0093969683870de4cbce93b6cb5dafa55121f662 (patch) | |
| tree | 35a691321158afc0a35a0b614860f96993b02356 | |
| parent | 9721317cf822815a48b8b8986212622ea1079788 (diff) | |
| parent | 5c3c259c547e025dadb1aa488a36aa8a56d4e4aa (diff) | |
Merge pull request #7709 from xmake-io/runtime
fix clang runtime flags
| -rw-r--r-- | xmake/core/package/package.lua | 17 |
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 |
