Generate a custom deployment script.

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.5.


    [TARGET target]
    [NAME script_name]
    [CONTENT content]

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


The command generates a script whose full file path will be stored in the variable named by the OUTPUT_SCRIPT 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 command takes care of generating a file named suitably for multi-config generators. Necessary includes are added such that Qt's CMake deployment functions and variables are accessible.

The TARGET argument specifies the target that will be deployed by the script. This affects the file name of the generated script, unless NAME is specified.

The NAME argument controls an identifiable portion within the deployment script's automatically generated name. The NAME argument defaults to custom if neither NAME nor TARGET are given.

The CONTENT argument specifies the code that is written to the deployment script. The content may contain generator expressions.

This command is intended for generating custom deployment scripts that directly call functions of Qt's deployment API. For less complex deployment purposes, it is more convenient to use qt_generate_deploy_app_script() or qt_generate_deploy_qml_app_script().


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
    OUTPUT_SCRIPT deploy_script
install(SCRIPT ${deploy_script})

See also qt_generate_deploy_app_script() and qt_generate_deploy_qml_app_script().

© 2024 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.