Write a qt.conf file at deployment time.

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

find_package(Qt6 REQUIRED COMPONENTS Core)

Unlike most other CMake commands provided by Qt, qt_deploy_qt_conf() can only be called from a deployment script. It cannot be called directly by the project.

This command was introduced in Qt 6.3.

Note: This command does not usually need to be called directly. It is used internally by other higher level commands, but projects wishing to implement more customized deployment logic may find it useful.


    [PREFIX prefix]
    [DOC_DIR doc_dir]
    [HEADERS_DIR headers_dir]
    [LIB_DIR lib_dir]
    [LIBEXEC_DIR libexec_dir]
    [BIN_DIR bin_dir]
    [PLUGINS_DIR plugins_dir]
    [QML_DIR qml_dir]
    [ARCHDATA_DIR archdata_dir]
    [DATA_DIR data_dir]
    [TRANSLATIONS_DIR translations_dir]
    [EXAMPLES_DIR examples_dir]
    [TESTS_DIR test_dir]
    [SETTINGS_DIR settings_dir]


Use this command when you need to generate a qt.conf file during deployment. The default value of any path supported by qt.conf can be overridden with the corresponding ..._DIR option. The command will only write a path to the generated qt.conf file if it differs from the default value. The default values can be found at Overriding Paths.

The file_path argument expects an absolute path to the location where the qt.conf file should be written to. The QT_DEPLOY_PREFIX and QT_DEPLOY_BIN_DIR variables can be used to dynamically specify a path relative to the deployment binary directory, as shown in the example below. This helps avoid hard-coding an absolute path.


# The following script must only be executed at install time
    OUTPUT_SCRIPT deploy_script
    DATA_DIR \"./custom_data_dir\"
    TRANSLATIONS_DIR \"./custom_translations_dir\"

install(SCRIPT ${deploy_script})

See also qt_generate_deploy_app_script() and qt_deploy_runtime_dependencies().

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