Revert "CMake: Fix configure -no-rpath"

This reverts commit 854986836a.
This reverts commit 392d9a5419.

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.

Pick-to: 6.5
Fixes: QTBUG-110816
Change-Id: I021d5e6cd775cbe5b2411d6771ab2545cb04f799
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Joerg Bornemann 2023-02-14 13:59:21 +01:00
parent d6bdc5e9b6
commit 2af494c930

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.