Skip to content

Commit

Permalink
gz-plugin CLI: set RPATH on macOS
Browse files Browse the repository at this point in the history
This CLI executable is installed to a subfolder
of libexec, so it needs a different relative
path to be used for the RPATH.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Sep 12, 2023
1 parent 0e30b52 commit c5d69a4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions loader/src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ target_link_libraries(${plugin_executable}

set(EXE_INSTALL_DIR "${CMAKE_INSTALL_LIBEXECDIR}/gz/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}")

if (APPLE)
file(RELATIVE_PATH
EXE_INSTALL_DIR_RELATIVE_PATH_TO_PREFIX
"${CMAKE_INSTALL_PREFIX}/${EXE_INSTALL_DIR}"
"${CMAKE_INSTALL_PREFIX}"
)
set_target_properties(${plugin_executable} PROPERTIES
INSTALL_RPATH "@loader_path/${EXE_INSTALL_DIR_RELATIVE_PATH_TO_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
)
endif()

install(
TARGETS
${plugin_executable}
Expand Down

0 comments on commit c5d69a4

Please sign in to comment.