diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-03-04 17:50:08 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-06 10:34:54 +0000 |
commit | ad0c09d3632935e9f951f895214ca0f1037a1c78 (patch) | |
tree | 7e688d59d84e864f040aa584f1a5c0ea72fea3ec | |
parent | 56d1754c2ea5ef670187b6034421c17d307d3e73 (diff) |
CMake: Don't add default rpaths to qt qml plugins when requested
qt_add_qml_plugin has code to set a sensible install rpath for user
project qml plugins.
If Qt was configured without rpath support, we should not add any
rpaths to qt qml plugins:
- qt-computed rpaths added by qt_apply_rpaths
- user-project rpaths added by qt_add_qml_plugin
This is done by setting QT_NO_QML_PLUGIN_RPATH to TRUE as part of
QtSetup, effectively applying the option to any qml plugin that is
built by internal qt api.
User projects will still be able to use the default rpaths added
by qt_add_qml_plugin, even if qt itself was configured with no rpath
support.
Fixes: QTBUG-122687
Change-Id: I8178b527553dd00436d0abb3b44061ea16edc121
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 375f3869308fd01c276b17581ef827583550dba3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/QtRpathHelpers.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cmake/QtRpathHelpers.cmake b/cmake/QtRpathHelpers.cmake index a8e3bb5fe4..da6c8715a8 100644 --- a/cmake/QtRpathHelpers.cmake +++ b/cmake/QtRpathHelpers.cmake @@ -217,6 +217,24 @@ macro(qt_internal_set_default_rpath_settings) if(NOT QT_NO_DISABLE_CMAKE_INSTALL_RPATH_USE_LINK_PATH) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) endif() + + # If Qt is built without rpath support, we should not add "user-project default rpaths" to + # qt qml plugins. Do this by setting QT_NO_QML_PLUGIN_RPATH to TRUE, which is + # then read by qt6_add_qml_plugin. + # We do this as part of the internal API, because we still want to allow user project qml + # plugins to have sensible default rpaths, even if Qt qml plugins were built without support + # for rpaths. + # + # Note that feature evaluation is not done yet in qtbase at this point, so we check both + # feature variable variants. In practice it doesn't really matter, because the variable is only + # read during qtdeclarative configuration time when the feature is already evaluated. + # + # We also make sure not to set it as a cache var just in case somebody wants to override it + # per directory scope. + if(NOT DEFINED QT_NO_QML_PLUGIN_RPATH + AND (QT_DISABLE_RPATH OR (NOT FEATURE_rpath) OR (NOT QT_FEATURE_rpath))) + set(QT_NO_QML_PLUGIN_RPATH "TRUE") + endif() endmacro() # Overrides the CMAKE_STAGING_PREFIX in a subdirectory scope, to stop CMake from rewriting build |