diff options
| author | ruki <[email protected]> | 2026-08-16 12:09:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-16 12:09:04 +0800 |
| commit | 5c3c259c547e025dadb1aa488a36aa8a56d4e4aa (patch) | |
| tree | f4af4d4ef29de5d92be27089685adcc2dd78ceb1 | |
| parent | 65854acd5e7080dae4cac3e3b3ec1ce01e902ae7 (diff) | |
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 |
