From 1e403add6ddec34436fd37cb800b62af4230b666 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 29 Dec 2021 21:37:49 +0100 Subject: [PATCH] Make the RPATH relative for the Linux binary issue #904 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7715017e..6d0e7a322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,6 +254,14 @@ if (WIN32) endif() +if (UNIX) + # Set the RPATH in the binary to a relative one to allow it to find our Qt + # libraries regardless of where the base installation directory is. + file(RELATIVE_PATH QT_LIBRARY_REL_PATH "${CMAKE_BINARY_DIR}/Release" "${QT_CMAKE_HOME_DIR}/../..") + set_target_properties(${CORE_WIDGETS_ADDON} PROPERTIES INSTALL_RPATH "\$ORIGIN/${QT_LIBRARY_REL_PATH}") + set_target_properties(${CORE_WIDGETS_ADDON} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) +endif() + target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE "${CMAKE_JS_LIB}" Qt5::Widgets