summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-23 23:57:34 +0800
committerruki <[email protected]>2021-06-23 23:57:34 +0800
commit58907f76aae6bfa0cac16e534f611099130a4fc7 (patch)
tree069782d42591e77f1477d96395751981390121d9
parenta36767e5f375e788e433299c9b38f52aefae4a8e (diff)
update changelog
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/rules/utils/inherit_links/inherit_links.lua26
2 files changed, 25 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e76f4205c..33dda74ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@
* [#1413](https://github.com/xmake-io/xmake/issues/1413): Fix hangs on fetching packages
* [#1420](https://github.com/xmake-io/xmake/issues/1420): Fix config and packages cache
* [#1445](https://github.com/xmake-io/xmake/issues/1445): Fix WDK driver sign error
+* [#1465](https://github.com/xmake-io/xmake/issues/1465): Fix missing link directory
## v2.5.4
@@ -1039,6 +1040,7 @@
* [#1413](https://github.com/xmake-io/xmake/issues/1413): 修复查找包过程中出现的挂起卡死问题
* [#1420](https://github.com/xmake-io/xmake/issues/1420): 修复包检测和配置缓存
* [#1445](https://github.com/xmake-io/xmake/issues/1445): 修复 WDK 驱动签名错误
+* [#1465](https://github.com/xmake-io/xmake/issues/1465): 修复缺失的链接目录
## v2.5.4
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