From 2aef5e4eef265305f068fef83c8dcdc5a240c648 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 28 Jun 2024 22:21:10 +0200 Subject: [PATCH] build: Lock install path in rpath behind an option --- cmake/modules/ImHexPlugin.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/ImHexPlugin.cmake b/cmake/modules/ImHexPlugin.cmake index 32cbad7af..2b3024c29 100644 --- a/cmake/modules/ImHexPlugin.cmake +++ b/cmake/modules/ImHexPlugin.cmake @@ -94,11 +94,18 @@ macro(add_imhex_plugin) INSTALL_RPATH "@executable_path/../Frameworks;@executable_path/plugins" ) elseif (UNIX) + set(PLUGIN_RPATH "") + list(APPEND PLUGIN_RPATH "$ORIGIN") + + if (IMHEX_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH) + list(APPEND PLUGIN_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + endif() + set_target_properties( ${IMHEX_PLUGIN_NAME} PROPERTIES INSTALL_RPATH_USE_ORIGIN ON - INSTALL_RPATH "$ORIGIN/;${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_RPATH "${PLUGIN_RPATH}" ) endif()