diff options
| author | ruki <[email protected]> | 2021-06-23 23:57:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-06-23 23:57:34 +0800 |
| commit | 58907f76aae6bfa0cac16e534f611099130a4fc7 (patch) | |
| tree | 069782d42591e77f1477d96395751981390121d9 /xmake/rules | |
| parent | a36767e5f375e788e433299c9b38f52aefae4a8e (diff) | |
update changelog
Diffstat (limited to 'xmake/rules')
| -rw-r--r-- | xmake/rules/utils/inherit_links/inherit_links.lua | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua index 7ea7aba28..97c585ded 100644 --- a/xmake/rules/utils/inherit_links/inherit_links.lua +++ b/xmake/rules/utils/inherit_links/inherit_links.lua @@ -26,6 +26,26 @@ function _get_values_from_target(target, name) return values end +-- @note we cannot directly set `{interface = true}`, because it will overwrite the previous configuration +-- https://github.com/xmake-io/xmake/issues/1465 +function _add_export_value(target, name, value) + local has_private = false + local private_values = target:get(name) + if private_values then + for _, v in ipairs(private_values) do + if v == value then + has_private = true + break + end + end + end + if has_private then + target:add(name, value, {public = true}) + else + target:add(name, value, {interface = true}) + end +end + -- main entry function main(target) @@ -40,17 +60,17 @@ function main(target) local targetfile = target:targetfile() -- we need move target link to head - target:add("links", target:linkname(), {interface = true}) + _add_export_value(target, "links", target:linkname()) 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}) + _add_export_value(target, "linkdirs", path.directory(targetfile)) if target:rule("go") then -- we need add includedirs to support import modules for golang - target:add("includedirs", path.directory(targetfile), {interface = true}) + _add_export_value(target, "includedirs", path.directory(targetfile)) end -- we export all links and linkdirs in self/packages/options to the parent target by default |
