summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/core/tools/gcc.lua6
-rw-r--r--xmake/rules/linker/soname/xmake.lua4
2 files changed, 6 insertions, 4 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 1d4a9e8f9..15ce30280 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -494,8 +494,10 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib
local flags_extra = {}
if targetkind == "shared" and self:is_plat("macosx", "iphoneos", "watchos") then
- table.insert(flags_extra, "-install_name")
- table.insert(flags_extra, "@rpath/" .. path.filename(targetfile))
+ if not table.contains(flags, "-install_name") then
+ table.insert(flags_extra, "-install_name")
+ table.insert(flags_extra, "@rpath/" .. path.filename(targetfile))
+ end
end
-- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
diff --git a/xmake/rules/linker/soname/xmake.lua b/xmake/rules/linker/soname/xmake.lua
index 8bb160b64..34179f858 100644
--- a/xmake/rules/linker/soname/xmake.lua
+++ b/xmake/rules/linker/soname/xmake.lua
@@ -24,9 +24,9 @@ rule("linker.soname")
if target:is_shared() and soname then
if target:has_tool("sh", "gcc", "gxx", "clang", "clangxx") then
if target:is_plat("macosx", "iphoneos", "watchos", "appletvos") then
- target:add("shflags", "-Wl,-install_name," .. soname, {force = true})
+ target:add("shflags", "-Wl,-install_name,@rpath/" .. soname, {force = true})
else
- target:add("shflags", "-Wl,-soname," .. soname, {force = true})
+ target:add("shflags", "-Wl,-soname,@rpath/" .. soname, {force = true})
end
target:data_set("soname.enabled", true)
end