1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5\page qt-generate-deploy-app-script.html
6\ingroup cmake-commands-qtcore
8\title qt_generate_deploy_app_script
9\keyword qt6_generate_deploy_app_script
11\summary {Generate a deployment script for an application.}
13\include cmake-find-package-core.qdocinc
16\note This command is currently only supported on Windows, macOS, and Linux.
21qt_generate_deploy_app_script(
26 [NO_UNSUPPORTED_PLATFORM_ERROR]
27 [DEPLOY_TOOL_OPTIONS ...]
28 [PRE_INCLUDE_REGEXES regexes...]
29 [PRE_EXCLUDE_REGEXES regexes...]
30 [POST_INCLUDE_REGEXES regexes...]
31 [POST_EXCLUDE_REGEXES regexes...]
32 [POST_INCLUDE_FILES files...]
33 [POST_EXCLUDE_FILES files...]
37\versionlessCMakeCommandsNote qt6_generate_deploy_app_script()
41Installing an executable target with \l{install(TARGETS)} only installs the
42target's executable (except for macOS app bundles, which will copy the whole
43bundle). You need to explicitly install any other libraries or plugins the
44executable depends on yourself. \c{qt_generate_deploy_app_script()} is a
45convenience command intended to simplify that process. It expects the
46application to follow Qt's recommended install directory structure fairly
47closely. That structure is based on CMake's default install layout, as
48determined by \l{GNUInstallDirs} (except for macOS app bundles, which follow
49Apple's requirements instead).
51The command generates a script whose name will be stored in the variable named
52by the \c{OUTPUT_SCRIPT} option. That script is only written at CMake
53generation time. It is intended to be used with the \l{install(SCRIPT)} command,
54which should come after the application's target has been installed using
57The deployment script will call \l{qt6_deploy_runtime_dependencies}
58{qt_deploy_runtime_dependencies()} with a suitable set of options for the standard
59install layout. Currently, this is only implemented for
61 \li macOS app bundles built on a macOS host,
62 \li Linux executables built on a Linux host,
63 \li and Windows executables built on a Windows host.
65Cross-building a Windows executable on a Linux host, as well as similar
66scenarios, are not currently supported.
67Calling \c{qt_generate_deploy_app_script()} in such a case will result
68in a fatal error, unless the \c{NO_UNSUPPORTED_PLATFORM_ERROR} option is given.
70On platforms other than macOS, Qt translations are automatically deployed. To
71inhibit this behavior, specify \c{NO_TRANSLATIONS}. Use
72\l{qt6_deploy_translations}{qt_deploy_translations()} to deploy translations in a
75For Windows desktop applications, the required runtime files for the compiler
76are also installed by default. To prevent this, specify \c{NO_COMPILER_RUNTIME}.
78Since Qt 6.7, you can use \c{DEPLOY_TOOL_OPTIONS} to pass additional options to
79the underlying deployment tool. This only has an effect if the underlying
80deployment tool is either macdeployqt or windeployqt.
82For deploying a QML application, use
83\l{qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()}
86For generating a custom deployment script, use
87\l{qt6_generate_deploy_script}{qt_generate_deploy_script}.
89The options \c{PRE_INCLUDE_REGEXES}, \c{PRE_EXCLUDE_REGEXES},
90\c{POST_INCLUDE_REGEXES}, \c{POST_EXCLUDE_REGEXES}, \c{POST_INCLUDE_FILES}, and
91\c{POST_EXCLUDE_FILES} can be specified to control the deployment of runtime
92dependencies. These options do not apply to all platforms and are forwarded
93unmodified to \l{qt6_deploy_runtime_dependencies}{qt_deploy_runtime_dependencies()}.
95\sa {qt6_standard_project_setup}{qt_standard_project_setup()},
96 {qt6_generate_deploy_script}{qt_generate_deploy_script()},
97 {qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()}
101The following example shows how to deploy an application \c{MyApp}.
103\include cmake-generate-deploy-app-script.qdocinc
105The following example shows how to use the \c{DEPLOY_TOOL_OPTIONS} parameter to
106pass different options to macdeployqt and windeployqt.
108\include cmake-generate-deploy-app-script-deploy-tool-options.qdocinc