Revert "CMake: Fix configure -no-rpath"

This reverts commit 854986836a581da694d169744e5487c5ce5f44bf.
This reverts commit 392d9a54194d06e96bfebdaf081aa6c9787e33ab.

Turns out that enabling this option is now breaking the Qt build,
because tools that are called by the Qt build cannot run anymore due to
the lack of rpaths.

Before, QT_DISABLE_RPATH was simply turning off Qt's additional rpaths
but left CMake's rpath defaults intact.

To implement a working -no-rpath switch we must add Linux and macOS code
paths to _qt_internal_generate_tool_command_wrapper and set
LD_LIBRARY_PATH/DYLD_LIBRARY_PATH and friends.

Fixes: QTBUG-110816
Change-Id: I021d5e6cd775cbe5b2411d6771ab2545cb04f799
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2af494c93076cd2acf4493501e472147422a7670)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann 2023-02-14 13:59:21 +01:00 committed by Qt Cherry-pick Bot
parent b8eeb2d68a
commit e2d1c5d139

View File

@ -82,6 +82,12 @@ function(qt_apply_rpaths)
return()
endif()
# Rpaths explicitly disabled (like for uikit), equivalent to qmake's no_qt_rpath.
# Or feature was turned OFF.
if(QT_DISABLE_RPATH OR NOT QT_FEATURE_rpath)
return()
endif()
cmake_parse_arguments(PARSE_ARGV 0 arg
"RELATIVE_RPATH"
"TARGET;INSTALL_PATH"
@ -110,21 +116,6 @@ function(qt_apply_rpaths)
message(FATAL_ERROR "No INSTALL_PATH given to qt_apply_rpaths.")
endif()
# Rpaths explicitly disabled (like for uikit), equivalent to qmake's no_qt_rpath.
# Or feature was turned OFF.
if(QT_DISABLE_RPATH OR NOT QT_FEATURE_rpath)
set_target_properties(${target} PROPERTIES
SKIP_BUILD_RPATH ON
SKIP_INSTALL_RPATH ON
)
if(APPLE)
set_target_properties(${target} PROPERTIES
MACOSX_RPATH OFF
)
endif()
return()
endif()
set(rpaths "")
# Modify the install path to contain the nested structure of a framework.