diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-09-07 15:45:37 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-08 18:35:30 +0000 |
commit | f38b580004fd2117485040120670b78fa295b7ad (patch) | |
tree | c2425926dcf41cedff5956f061b99d47ee6bcefa /src | |
parent | 1a29e946ee809ab32ee508a6823c4ec3ca668b34 (diff) |
CMake: Use modified target name as base name for internal qml plugins
Using only the last dot component of the URI as the plugin base name
causes issues when an app that uses QtQuickControls2 is
macdeployqt'ed.
The qqc2 impl plugins all have "impl" as the last URI component and
thus they all use "impl" as the base name.
macdeployqt tries to copy all of the plugins into a flattened
PlugIns/quick folder, which ends up copying only one of the files.
User qml plugins use the plugin target name as the plugin base name
and plugin file name on-disk.
There shouldn't be a reason for internal qml plugins to deviate too
much from that.
Adjust the internal qml plugin name to use the plugin target name with
"plugin" suffixed at the end, but make sure to remove any existing
"plugin" from the target name if it already exists, so we don't end up
with double "plugin" in the base name.
Amends a25f650c317e4886007a8beb0e9f2f7e973e6e7c
Task-number: QTBUG-95140
Task-number: QTBUG-96261
Change-Id: If6096e88bf2da3de081d68fad2e70cef5a0b18af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 658a911f9c8789418710bcbd9513774de89cb082)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/Qt6QmlBuildInternals.cmake | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake index f979c9f656..bfc01b3cc0 100644 --- a/src/qml/Qt6QmlBuildInternals.cmake +++ b/src/qml/Qt6QmlBuildInternals.cmake @@ -219,13 +219,25 @@ function(qt_internal_add_qml_module target) qt_internal_add_plugin(${arg_PLUGIN_TARGET} ${plugin_args}) - # Get the last dot-separated part of the URI. There should only be one - # plugin library in the output directory, so we shouldn't need to - # include the full URI namespace. - string(REGEX REPLACE "^(.*\\.)?([^.]+)$" "\\2" plugin_basename "${arg_URI}") - # Add the infix and "plugin", lowercase that and use it as the basename - # of the plugin library. - string(TOLOWER "${plugin_basename}${QT_LIBINFIX}plugin" plugin_basename) + # Use the plugin target name as the main part of the plugin basename. + set(plugin_basename "${arg_PLUGIN_TARGET}") + + # If the target name already ends with a "plugin" suffix, remove it and re-add it to the end + # of the base name after the infix. + if(plugin_basename MATCHES "(.+)plugin$") + set(plugin_basename "${CMAKE_MATCH_1}") + endif() + + # Add a the infix if Qt was configured with one. + if(QT_LIBINFIX) + string(APPEND plugin_basename "${QT_LIBINFIX}") + endif() + + # Add the "plugin" suffix after the infix. + string(APPEND plugin_basename "plugin") + + # Lowercase the whole thing and use it as the basename of the plugin library. + string(TOLOWER "${plugin_basename}" plugin_basename) set_target_properties(${arg_PLUGIN_TARGET} PROPERTIES OUTPUT_NAME "${plugin_basename}" ) |