diff options
| author | ruki <[email protected]> | 2020-12-04 00:36:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-04 00:36:19 +0800 |
| commit | 153ae307f21b27b00e1d9cfcf26b45749da35d9d (patch) | |
| tree | c79af1b40e644561fb7f48432c9c801976ef02e3 | |
| parent | 3a153263bb876ea1447cc8d747a76d5ba41d6047 (diff) | |
fix inherit links
| -rw-r--r-- | xmake/core/project/target.lua | 5 | ||||
| -rw-r--r-- | xmake/rules/utils/inherit_links/inherit_links.lua | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index ca5d0f1e4..9c0ecdacd 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -266,6 +266,9 @@ end -- get interface -- - target:get("cflags", {interface = true}) -- +-- get raw reference of values +-- - target:get("cflags", {rawref = true}) +-- function _instance:get(name, opt) -- get values @@ -278,7 +281,7 @@ function _instance:get(name, opt) local vs_required = self:_visibility(opt) -- get all values? (private and interface) - if vs_required == vs_public then + if vs_required == vs_public or (opt and opt.rawref) then return values end diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua index 07fcb7d19..cb3be74a9 100644 --- a/xmake/rules/utils/inherit_links/inherit_links.lua +++ b/xmake/rules/utils/inherit_links/inherit_links.lua @@ -38,8 +38,15 @@ function main(target) local targetkind = target:targetkind() if targetkind == "shared" or targetkind == "static" then local targetfile = target:targetfile() - local links = target:get("links", {interface = true}) - target:set("links", table.join(target:basename(), links), {interface = true}) -- we need move target link to head + + -- we need move target link to head + target:add("links", target:basename(), {interface = true}) + local links = target:get("links", {rawref = true}) + if links and type(links) == "table" and #links > 1 then + table.insert(links, 1, links[#links]) + table.remove(links, #links) + end + target:add("linkdirs", path.directory(targetfile), {interface = true}) if target:rule("go") then -- we need add includedirs to support import modules for golang |
