From 29dc4ba9c8f3e6703d0cf2d3b54df5b7443c1d5b Mon Sep 17 00:00:00 2001 From: Coelacanthus Date: Wed, 20 Dec 2023 09:39:14 +0800 Subject: [PATCH] fix: RPATH in macOS, who use @loader_path instead of $ORIGIN (#26) All UNIX like OS use $ORIGIN except f**king macOS, who use @loader_path. Ref: https://lekensteyn.nl/rpath.html --- src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74963de..f90b8c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,11 @@ option(LINUX_MINGW32 "Build for windows on Linux" OFF) +if(APPLE) + set(RPATH_BINARY_PATH "@loader_path") +else() + set(RPATH_BINARY_PATH "$ORIGIN") +endif() + include_directories(.) aux_source_directory(. DIR_LPAC_SRCS) aux_source_directory(applet DIR_LPAC_SRCS) @@ -9,7 +15,7 @@ aux_source_directory(applet/profile DIR_LPAC_SRCS) add_executable(lpac ${DIR_LPAC_SRCS}) set_target_properties(lpac PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/output" - BUILD_RPATH "$ORIGIN" + BUILD_RPATH "${RPATH_BINARY_PATH}" ) target_link_libraries(lpac euicc)