diff options
| author | ruki <[email protected]> | 2024-09-21 22:19:28 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-09-21 22:19:28 +0800 |
| commit | a44ccf767d56f8e74006d52616a0234b63ff13f8 (patch) | |
| tree | 6e900dfecfb47bfe6156c5d08906606e5acc1a7b | |
| parent | cf25706288e3c890855388e113785b0e53e0338a (diff) | |
| parent | 2c2b0f08e4f4f3b65a153f06d49f4728c3f77615 (diff) | |
Merge pull request #5644 from xmake-io/ldflags
add special language linker flags for package
| -rw-r--r-- | xmake/core/tool/builder.lua | 11 | ||||
| -rw-r--r-- | xmake/core/tool/linker.lua | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 54652326d..2bf4efc1f 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -222,8 +222,17 @@ end -- add flags from the target packages function builder:_add_flags_from_targetpkgs(flags, target) + local kind = self:kind() for _, flagkind in ipairs(self:_flagkinds()) do - local result = target:get_from(flagkind, "package::*") + -- attempt to add special lanugage flags from package first, e.g. gcldflags, dcarflags + -- @see https://github.com/xmake-io/xmake-repo/issues/5255 + local result + if kind:endswith("ld") or kind:endswith("sh") then + result = target:get_from(kind .. "flags", "package::*") + end + if not result then + result = target:get_from(flagkind, "package::*") + end if result then for _, values in ipairs(table.wrap(result)) do table.join2(flags, self:_mapflags(values, flagkind, target)) diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 070c90a9f..2094d40a5 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -63,7 +63,7 @@ function linker:_add_flags_from_linker(flags) local toolkind = self:kind() for _, flagkind in ipairs(self:_flagkinds()) do -- attempt to add special lanugage flags first, e.g. gcldflags, dcarflags - table.join2(flags, self:get(toolkind .. 'flags') or self:get(flagkind)) + table.join2(flags, self:get(toolkind .. "flags") or self:get(flagkind)) end end |
