diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-05-13 09:24:27 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-05-15 09:55:51 +0000 |
| commit | bcb26ad44c6cca176fafe5ce066d547cca8f235a (patch) | |
| tree | 1557f374fe1d342a44fc00a250bcfe2ffb71598b | |
| parent | de124ad2973ec15002d6e93dd2db08a74fce9ef1 (diff) | |
CMake: Fix app QML post bundle deployment with the Xcode generator
Xcode is a multi-config generator to places the application binary dir
into a config specific sub-directory like Debug.
The qml post build symlinking code did not account for that. Make sure
to pass the configuration subdirectory both in the overridden
QT_DEPLOY_PREFIX and CMAKE_INSTALL_PREFIX (pointing to the
config-specific app build dir).
Fixes: QTBUG-125153
Change-Id: I75f0dcf0bee56fe2a3c64274fe4b96a784d2f834
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 757bfef221654d5aeee72086393bd67b2c8554e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| -rw-r--r-- | src/qml/Qt6QmlDeploySupport.cmake | 5 | ||||
| -rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 23 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/qml/Qt6QmlDeploySupport.cmake b/src/qml/Qt6QmlDeploySupport.cmake index a230e71409..0e3720e923 100644 --- a/src/qml/Qt6QmlDeploySupport.cmake +++ b/src/qml/Qt6QmlDeploySupport.cmake @@ -159,6 +159,11 @@ function(_qt_internal_deploy_qml_imports_for_target) # file names, so account for those. There should never be plugin # libraries for more than one QML module in the directory, so we # shouldn't need to worry about matching plugins we don't want. + # + # install_qmldir and install_plugin do not contain $ENV{DESTDIR}, + # whereas dest_qmldir and dest_plugin do. + # The install_ variants are used in file(INSTALL) to avoid double DESTDIR in paths. + # Other code should reference the dest_ variants instead. set(relative_qmldir "${arg_QML_DIR}/${entry_RELATIVEPATH}") if("${CMAKE_INSTALL_PREFIX}" STREQUAL "") set(install_qmldir "./${relative_qmldir}") diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 6d238d454a..edadcd1e1f 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -3796,9 +3796,30 @@ endif()") # imports deployed to the bundle anyway, the build RPATHs will allow # the regular libraries, frameworks and non-QML plugins to still be # found, even if they are outside the app bundle. + + # Support Xcode, which places the application build dir into a configuration specific + # subdirectory. Override both the deploy prefix and install prefix, because we + # differentiate them in the qml installation implementation due to ENV{DESTDIR} + # handling. + set(deploy_path_suffix "") + get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + set(deploy_path_suffix "/$<CONFIG>") + endif() + + set(target_binary_dir_with_config_prefix + "$<TARGET_PROPERTY:${arg_TARGET},BINARY_DIR>${deploy_path_suffix}") + + set(post_build_install_prefix + "CMAKE_INSTALL_PREFIX=${target_binary_dir_with_config_prefix}") + + set(post_build_deploy_prefix + "QT_DEPLOY_PREFIX=${target_binary_dir_with_config_prefix}") + add_custom_command(TARGET ${arg_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - -D "QT_DEPLOY_PREFIX=$<TARGET_PROPERTY:${arg_TARGET},BINARY_DIR>" + -D "${post_build_install_prefix}" + -D "${post_build_deploy_prefix}" -D "__QT_DEPLOY_IMPL_DIR=${deploy_impl_dir}" -D "__QT_DEPLOY_POST_BUILD=TRUE" -P "${post_build_deploy_script}" |
