From ecd63d469f453d4fef6e807388e68451cdc2c043 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 13 May 2025 16:27:11 +0200 Subject: [PATCH] CMake: Fix rpath adjustment when deploying QML plugins If Qt is configured with a custom value for INSTALL_QMLDIR, e.g. via "configure -qmldir lib/qml", then we must adjust the rpath for QML plugins. Otherwise they won't be able to load Qt libraries. We had general code that adjusts the rpath for plugins, but that only triggered if INSTALL_LIBDIR was different from the user project's CMAKE_INSTALL_LIBDIR. Now, we always adjust the rpath of plugins on Linux. The operation is cheap, and I don't quite see how to add a robust condition for all desired cases. Pick-to: 6.8 6.9 Fixes: QTBUG-125223 Change-Id: Ib511fbc2b733deac804191773e56be9b6adf5e68 Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreMacros.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 7fb701c088a..5d38cd19658 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -3085,10 +3085,10 @@ function(_qt_internal_setup_deploy_support) # Check whether we will have to adjust the RPATH of plugins. if("${QT_DEPLOY_FORCE_ADJUST_RPATHS}" STREQUAL "") - set(must_adjust_plugins_rpath "") - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows" - AND NOT CMAKE_INSTALL_LIBDIR STREQUAL QT6_INSTALL_LIBS) + if(UNIX AND NOT APPLE) set(must_adjust_plugins_rpath ON) + else() + set(must_adjust_plugins_rpath OFF) endif() else() set(must_adjust_plugins_rpath "${QT_DEPLOY_FORCE_ADJUST_RPATHS}")