From 79214d746ae2528cb29da830f0d65556b0bbf9d0 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Tue, 22 Feb 2022 18:20:01 +0100
Subject: [PATCH] Correct RPATH information in the executables

When building the executables the needed PATH information to find necessary
libraries is stored in the executable. This PATH information is now also
present in the installed executables such that they work without adding PATH
information to the envirnonment.
---
 MQ/CMakeLists.txt | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/MQ/CMakeLists.txt b/MQ/CMakeLists.txt
index 9e0a8c039d..0aeb4fccbb 100644
--- a/MQ/CMakeLists.txt
+++ b/MQ/CMakeLists.txt
@@ -9,6 +9,24 @@ else()
   Set(FAIRMQ_LIBS FairMQ)
 EndIf()
 
+# RPATH information should be present for executables in the build as well
+# as in the installation directory
+
+# use, i.e. don't skip the full RPATH for the build tree
+set(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+# when building, don't use the install RPATH already
+# (but later on when installing)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+# add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+
+
 add_subdirectory(base)
 add_subdirectory(source)
 add_subdirectory(sink)
-- 
GitLab