Skip to content

Commit 73fe013

Browse files
committed
fix: Fix RPATH so it works on macos
1 parent e51f200 commit 73fe013

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ function(llama_cpp_python_install_target target)
2626
INSTALL_RPATH "$ORIGIN"
2727
BUILD_WITH_INSTALL_RPATH TRUE
2828
)
29+
if(UNIX)
30+
if(APPLE)
31+
set_target_properties(${target} PROPERTIES
32+
INSTALL_RPATH "@loader_path"
33+
BUILD_WITH_INSTALL_RPATH TRUE
34+
)
35+
else()
36+
set_target_properties(${target} PROPERTIES
37+
INSTALL_RPATH "$ORIGIN"
38+
BUILD_WITH_INSTALL_RPATH TRUE
39+
)
40+
endif()
41+
endif()
2942
endfunction()
3043

3144
if (LLAMA_BUILD)
@@ -40,7 +53,6 @@ if (LLAMA_BUILD)
4053
# Add the automatically determined parts of the RPATH
4154
# which point to directories outside the build tree to the install RPATH
4255
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
43-
set(CMAKE_INSTALL_RPATH "$ORIGIN")
4456
set(CMAKE_SKIP_RPATH FALSE)
4557

4658
# Building llama

0 commit comments

Comments
 (0)