diff options
| author | wsw0108 <[email protected]> | 2023-10-27 10:13:06 +0800 |
|---|---|---|
| committer | wsw0108 <[email protected]> | 2023-10-27 10:13:06 +0800 |
| commit | 985b2a9d54df1ac40a420dc853a7b35cd5e6e377 (patch) | |
| tree | 3a3790517ddb5947228df0557c96245d304050e0 /xmake/modules/core/tools/gcc.lua | |
| parent | 30b0405058c7a90ec60f36179993c74b59717994 (diff) | |
add @rpath to link flags when soname enabled
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 6589b6f13..4f6eb903f 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -488,8 +488,17 @@ 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)) + local soname_enabled = false + for _, v in pairs(flags) do + if string.find(v, "-install_name") then + soname_enabled = true + break + end + end + if not soname_enabled 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 |
