summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/tool/builder.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 1a4450a4c..34ed1e3b8 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -159,8 +159,15 @@ function builder:_inherit_from_targetdeps(results, target, flagname)
elseif flagname == "rpathdirs" and targetkind == "binary" then
+ -- make rpathdir
+ local rpathdir = "@loader_path"
+ local subdir = path.relative(path.directory(dep:targetfile()), path.directory(target:targetfile()))
+ if subdir and subdir ~= '.' then
+ rpathdir = path.join(rpathdir, subdir)
+ end
+
-- add dependent rpathdirs
- table.insert(results, "@loader_path")
+ table.insert(results, rpathdir)
elseif flagname == "includedirs" then