From 0e2c090e9205bc2f9fefe2bf150b7d38f47e04a3 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 17 Apr 2020 22:31:07 +0800 Subject: fix inherit links --- xmake/rules/utils/inherit_links/inherit_links.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua index 20b6e3000..a810df2e4 100644 --- a/xmake/rules/utils/inherit_links/inherit_links.lua +++ b/xmake/rules/utils/inherit_links/inherit_links.lua @@ -74,12 +74,14 @@ function main(target) if targetkind == "binary" then local targetdir = target:targetdir() for _, dep in ipairs(target:orderdeps()) do - local rpathdir = "@loader_path" - local subdir = path.relative(path.directory(dep:targetfile()), targetdir) - if subdir and subdir ~= '.' then - rpathdir = path.join(rpathdir, subdir) + if dep:targetkind() == "shared" then + local rpathdir = "@loader_path" + local subdir = path.relative(path.directory(dep:targetfile()), targetdir) + if subdir and subdir ~= '.' then + rpathdir = path.join(rpathdir, subdir) + end + target:add("rpathdirs", rpathdir) end - target:add("rpathdirs", rpathdir) end end end -- cgit v1.3.1