Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qt_generate_deploy_app_script.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-generate-deploy-app-script.html
6\ingroup cmake-commands-qtcore
7
8\title qt_generate_deploy_app_script
9\keyword qt6_generate_deploy_app_script
10
11\summary {Generate a deployment script for an application.}
12
13\include cmake-find-package-core.qdocinc
14
15\cmakecommandsince 6.3
16\note This command is currently only supported on Windows, macOS, and Linux.
17
18\section1 Synopsis
19
20\badcode
21qt_generate_deploy_app_script(
22 TARGET target
23 OUTPUT_SCRIPT <var>
24 [NO_TRANSLATIONS]
25 [NO_COMPILER_RUNTIME]
26 [NO_UNSUPPORTED_PLATFORM_ERROR]
27 [PRE_INCLUDE_REGEXES regexes...]
28 [PRE_EXCLUDE_REGEXES regexes...]
29 [POST_INCLUDE_REGEXES regexes...]
30 [POST_EXCLUDE_REGEXES regexes...]
31 [POST_INCLUDE_FILES files...]
32 [POST_EXCLUDE_FILES files...]
33)
34\endcode
35
36\versionlessCMakeCommandsNote qt6_generate_deploy_app_script()
37
38\section1 Description
39
40Installing an executable target with \l{install(TARGETS)} only installs the
41target's executable (except for macOS app bundles, which will copy the whole
42bundle). You need to explicitly install any other libraries or plugins the
43executable depends on yourself. \c{qt_generate_deploy_app_script()} is a
44convenience command intended to simplify that process. It expects the
45application to follow Qt's recommended install directory structure fairly
46closely. That structure is based on CMake's default install layout, as
47determined by \l{GNUInstallDirs} (except for macOS app bundles, which follow
48Apple's requirements instead).
49
50The command generates a script whose name will be stored in the variable named
51by the \c{OUTPUT_SCRIPT} option. That script is only written at CMake
52generation time. It is intended to be used with the \l{install(SCRIPT)} command,
53which should come after the application's target has been installed using
54\l{install(TARGETS)}.
55
56The deployment script will call \l{qt6_deploy_runtime_dependencies}
57{qt_deploy_runtime_dependencies()} with a suitable set of options for the standard
58install layout. Currently, this is only implemented for
59\list
60 \li macOS app bundles built on a macOS host,
61 \li Linux executables built on a Linux host,
62 \li and Windows executables built on a Windows host.
63\endlist
64Cross-building a Windows executable on a Linux host, as well as similar
65scenarios, are not currently supported.
66Calling \c{qt_generate_deploy_app_script()} in such a case will result
67in a fatal error, unless the \c{NO_UNSUPPORTED_PLATFORM_ERROR} option is given.
68
69On platforms other than macOS, Qt translations are automatically deployed. To
70inhibit this behavior, specify \c{NO_TRANSLATIONS}. Use
71\l{qt6_deploy_translations}{qt_deploy_translations()} to deploy translations in a
72customized way.
73
74For Windows desktop applications, the required runtime files for the compiler
75are also installed by default. To prevent this, specify \c{NO_COMPILER_RUNTIME}.
76
77For deploying a QML application, use
78\l{qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()}
79instead.
80
81For generating a custom deployment script, use
82\l{qt6_generate_deploy_script}{qt_generate_deploy_script}.
83
84The options \c{PRE_INCLUDE_REGEXES}, \c{PRE_EXCLUDE_REGEXES},
85\c{POST_INCLUDE_REGEXES}, \c{POST_EXCLUDE_REGEXES}, \c{POST_INCLUDE_FILES}, and
86\c{POST_EXCLUDE_FILES} can be specified to control the deployment of runtime
87dependencies. These options do not apply to all platforms and are forwarded
88unmodified to \l{qt6_deploy_runtime_dependencies}{qt_deploy_runtime_dependencies()}.
89
90\sa {qt6_standard_project_setup}{qt_standard_project_setup()},
91 {qt6_generate_deploy_script}{qt_generate_deploy_script()},
92 {qt6_generate_deploy_qml_app_script}{qt_generate_deploy_qml_app_script()}
93
94\section1 Example
95
96\include cmake-generate-deploy-app-script.qdocinc
97*/