From c41b27e31ea3f52a9b9ae69809aeb431d6e5fe9b Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Thu, 7 Mar 2024 12:04:54 +0100 Subject: improve rpath support for clang macOS --- xmake/modules/core/tools/clang.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 39f90025b..5da649779 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -314,6 +314,10 @@ function nf_runtime(self, runtime, opt) end end if rpath_flags then + if target:kind() == "shared" and self:is_plat("macosx", "iphoneos", "watchos") then + table.insert(rpath_flags, "-install_name") + table.insert(rpath_flags, "@rpath/" .. path.filename(target:filename())) + end maps["c++_shared"] = table.join(maps["c++_shared"], rpath_flags) end end -- cgit v1.3.1