Generate a deployment script for an application.

The command is defined in the Core component of the Qt6 package, which can be loaded like so:

find_package(Qt6 REQUIRED COMPONENTS Core)

This command was introduced in Qt 6.3.

Note: This command is in technology preview and may change in future releases.

Note: This command is currently only supported on Windows and macOS.


    TARGET target

If versionless commands are disabled, use qt6_generate_deploy_app_script() instead. It supports the same set of arguments as this command.


Installing an executable target with install(TARGETS) only installs the target's executable (except for macOS app bundles, which will copy the whole bundle). You need to explicitly install any other libraries or plugins the executable depends on yourself. qt_generate_deploy_app_script() is a convenience command intended to simplify that process. It expects the application to follow Qt's recommended install directory structure fairly closely. That structure is based on CMake's default install layout, as determined by GNUInstallDirs (except for macOS app bundles, which follow Apple's requirements instead).

The command generates a script whose name will be stored in the variable named by the FILENAME_VARIABLE option. That script is only written at CMake generation time. It is intended to be used with the install(SCRIPT) command, which should come after the application's target has been installed using install(TARGETS).

The deployment script will call qt_deploy_runtime_dependencies() with a suitable set of options for the standard install layout. Currently, this is only implemented for macOS app bundles built on a macOS host and Windows executables built on a Windows host. Cross-building a Windows executable on a Linux host, as well as similar scenarios, are not currently supported. Calling qt_generate_deploy_app_script() in such a case will result in a fatal error, unless the NO_UNSUPPORTED_PLATFORM_ERROR option is given.

For deploying a QML application, use qt_generate_deploy_qml_app_script() instead.


cmake_minimum_required(VERSION 3.16...3.22)

find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(MyApp main.cpp)

install(TARGETS MyApp

    TARGET MyApp
    FILENAME_VARIABLE deploy_script
install(SCRIPT ${deploy_script})

See also qt_standard_project_setup() and qt_generate_deploy_qml_app_script().

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.