From 117a24dd957ca392a054d9757807fb2fec886ace Mon Sep 17 00:00:00 2001
From: Fabian Kosmale <fabian.kosmale@qt.io>
Date: Tue, 16 May 2023 16:22:17 +0200
Subject: [PATCH] use a relative rpath for rpath (to keep it relocatable)

---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc58a05..dca5bdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,9 +65,11 @@ cmake_path(APPEND module_dir "${qtqmldir}" "${module_target_path}")
 message(STATUS "Module dir ${module_dir}")
 
 # allow the installed plugin to find its backing library
+cmake_path(SET plugin2backinglibpath ${qtlibdir})
+cmake_path(RELATIVE_PATH plugin2backinglibpath  BASE_DIRECTORY ${module_dir})
 set_property(
     TARGET "${module_plugin_target}"
-    APPEND PROPERTY INSTALL_RPATH "${qtlibdir}"
+    APPEND PROPERTY INSTALL_RPATH "\${ORIGIN}/${plugin2backinglibpath}"
 )
 
 # Install the QML module runtime loadable plugin
-- 
GitLab