CMake: Fix rpaths set for Qt internal apps like Designer
qt_apply_rpaths takes into account properties like MACOSX_BUNDLE. This property might not yet be set when qt_internal_add_app is called, but later. To handle that, move the call of qt_apply_rpaths to qt_internal_finalize_app. As a result, the installed apps will have 2 rpaths, the $ORIGIN style relocatable one, and an absolute path one pointing to the Qt prefix/lib. The last one might be unnecessary. Fixes: QTBUG-86514 Change-Id: I25e0d695c78c8b5703e94c99cc2457f772721456 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
9346760f5a
commit
9a2ee31059
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user