From bb9be221339b67b7580e92efc673f8919f4b1db8 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Feb 2022 11:38:10 +0100 Subject: [PATCH] CMake: Fix rpath set for Qml plugins to not contain lib64 Qt6QmlMacros uses the value of GNUInstallDirs's CMAKE_INSTALL_LIBDIR to calculate the rpath from a Qml plugin's location to the Qt libraries. By default CMake detects the value of CMAKE_INSTALL_LIBDIR, and on an RHEL system it is set to 'lib64', whereas we usually configure Qt with the lib dir set to just 'lib'. This might cause issues with Qml plugins not locating the Qt libs due to an incorrect rpath. Ensure that when building Qt libraries and plugins, CMAKE_INSTALL_LIBDIR is set to the same lib dir value that Qt was configured with. Pick-to: 6.3 Fixes: QTBUG-99707 Task-number: QTBUG-100432 Change-Id: I17b2a22d46ef3b40084a2f6a4992f0e23b35d4d3 Reviewed-by: Alexey Edelev --- cmake/QtBuild.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index b411c6031ac..6af23a499ee 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -251,6 +251,11 @@ set(CMAKE_INSTALL_RPATH "" CACHE STRING "RPATH for installed binaries") # link against QtCore. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +# Ensure that GNUInstallDirs's CMAKE_INSTALL_LIBDIR points to the same lib dir that Qt was +# configured with. Currently this is important for QML plugins, which embed an rpath based +# on that value. +set(CMAKE_INSTALL_LIBDIR "${INSTALL_LIBDIR}") + function(qt_setup_tool_path_command) if(NOT CMAKE_HOST_WIN32) return()