summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtAppHelpers.cmake8
-rw-r--r--cmake/QtBuild.cmake9
2 files changed, 13 insertions, 4 deletions
diff --git a/cmake/QtAppHelpers.cmake b/cmake/QtAppHelpers.cmake
index 845645a75e..20edc41b0a 100644
--- a/cmake/QtAppHelpers.cmake
+++ b/cmake/QtAppHelpers.cmake
@@ -40,10 +40,6 @@ function(qt_internal_add_app target)
qt_internal_add_target_aliases("${target}")
_qt_internal_apply_strict_cpp("${target}")
- if(NOT arg_NO_INSTALL)
- qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_BINDIR}" RELATIVE_RPATH)
- endif()
-
# To mimic the default behaviors of qt_app.prf, we by default enable GUI Windows applications,
# but don't enable macOS bundles.
# Bundles are enabled in a separate set_target_properties call if an Info.plist file
@@ -99,4 +95,8 @@ function(qt_internal_finalize_app target)
if(WIN32)
qt6_generate_win32_rc_file("${target}")
endif()
+
+ # Rpaths need to be applied in the finalizer, because the MACOSX_BUNDLE property might be
+ # set after a qt_internal_add_app call.
+ qt_apply_rpaths(TARGET "${target}" INSTALL_PATH "${INSTALL_BINDIR}" RELATIVE_RPATH)
endfunction()
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 27fe8d4226..92b4e7e400 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -247,6 +247,15 @@ 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
+#
+# 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)
function(qt_setup_tool_path_command)