summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2022-04-13 18:41:54 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2022-06-13 23:13:55 +0200
commitfb54e10b64e3aa6d9c89333e3dea35fdb39c82b7 (patch)
treebb127f1925548bd0da039415cd50fbcda5339e37 /cmake
parentc0e1fd501efce488de80fbcd4225f15ea8b66c3d (diff)
CMake: Disable CMAKE_INSTALL_RPATH_USE_LINK_PATH
There should be no need for CMake to add rpaths pointing to directories outside of the build tree to the installed libraries. All relevant install rpaths are handled by qt_apply_rpaths(). Fixes: QTBUG-103777 Change-Id: If554b1e3c790c2bb04a34e8b0524aab3febf5afc Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit a1d8b9023f499560b967965ef52af2a7de981727)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake20
1 files changed, 9 insertions, 11 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 4c15d1d7e1..dfd96ce576 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -238,18 +238,16 @@ endif("${isSystemDir}" STREQUAL "-1")
# Bottom line: No need to pass anything to CMAKE_INSTALL_RPATH.
set(CMAKE_INSTALL_RPATH "" CACHE STRING "RPATH for installed binaries")
-# add the automatically determined parts of the RPATH
-# which point to directories outside the build tree to the install RPATH
+# By default, don't embed auto-determined RPATHs pointing to directories
+# outside of the build tree, into the installed binaries.
+# This ended up adding rpaths like ${CMAKE_INSTALL_PREFIX}/lib (or /Users/qt/work/install/lib into
+# the official libraries created by the CI) into the non-qtbase libraries, plugins, etc.
#
-# TODO: Do we really want to use this option for official packages? Perhaps make it configurable
-# or remove it? This causes final installed binaries to contain an absolute path RPATH pointing
-# to ${CMAKE_INSTALL_PREFIX}/lib, which on the CI would be something like
-# /Users/qt/work/install/lib.
-# It doesn't seem necessary to me, given that qt_apply_rpaths already applies $ORIGIN-style
-# relocatable paths, but maybe i'm missing something, because the original commit that added the
-# option mentions it's needed in some cross-compilation scenario for program binaries that
-# link against QtCore.
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+# It should not be necessary, given that qt_apply_rpaths() already adds the necessary rpaths, either
+# relocatable ones or absolute ones, depending on what the platform supports.
+if(NOT QT_NO_DISABLE_CMAKE_INSTALL_RPATH_USE_LINK_PATH)
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+endif()
function(qt_setup_tool_path_command)
if(NOT CMAKE_HOST_WIN32)