diff options
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index ddfc264cc..1139bed0b 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -234,12 +234,16 @@ end -- make the rpathdir flag function nf_rpathdir(self, dir) - local flag_elf = "-Wl,-rpath=" .. dir - local flag_macho = "-Xlinker -rpath -Xlinker " .. dir if self:has_flags(flag_elf) then - return flag_elf - elseif self:has_flags(flag_macho) then - return flag_macho + return "-Wl,-rpath=" .. (dir:gsub("@[%w_]+", function (name) + local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"} + return maps[name] + end)) + elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir) then + return "-Xlinker -rpath -Xlinker " .. (dir:gsub("%$[%w_]+", function (name) + local maps = {["$ORIGIN"] = "@loader_path"} + return maps[name] + end)) end end |
