QTP0007

Quotes and escapes forwarded argument values in generated deploy scripts.

This policy was introduced in Qt 6.12. The policy affects how qt_generate_deploy_app_script() writes the values of the keywords it forwards to qt_deploy_runtime_dependencies(), such as DEPLOY_TOOL_OPTIONS, PRE_EXCLUDE_REGEXES and POST_EXCLUDE_FILES, into the deploy script it generates.

If the policy is set to OLD, the values are written unquoted. When the generated script runs, cmake splits each value at whitespace and interprets backslashes in it as escape sequences. This causes issues with values that contain whitespace, backslashes or double quotes.

If the policy is set to NEW, each value is written as a quoted argument, with backslashes and double quotes escaped, so that the value reaches qt_deploy_runtime_dependencies() unchanged.

When the policy is not set and a forwarded value contains whitespace, a backslash or a double quote, an AUTHOR_WARNING is emitted and the values are written unquoted for backwards compatibility. Values without those characters are unaffected, so no warning is emitted for them.

For example, a code signing identity that contains spaces:

# QTP0007 not set - AUTHOR_WARNING is emitted
qt_generate_deploy_app_script(
    TARGET MyApp
    OUTPUT_SCRIPT deploy_script
    DEPLOY_TOOL_OPTIONS "-codesign=Developer ID Application: Foo"
)

The identity reaches macdeployqt as several arguments, and the code signing step either picks the wrong identity or fails. Setting the policy to NEW passes it on as a single argument:

qt_policy(SET QTP0007 NEW)
qt_generate_deploy_app_script(
    TARGET MyApp
    OUTPUT_SCRIPT deploy_script
    DEPLOY_TOOL_OPTIONS "-codesign=Developer ID Application: Foo"
)

Note that a project which put several options into one whitespace-separated value relied on the OLD behavior to split them, and has to pass them as separate list elements once the policy is set to NEW:

# Relies on the \c OLD behavior to split the value into four options.
set(options "-hardened-runtime -timestamp -appstore-compliant -verbose=3")
# Correct way to pass options with the \c NEW behavior.
set(options -hardened-runtime -timestamp -appstore-compliant -verbose=3)

Note: The OLD behavior of a policy is deprecated, and may be removed in the future.

See also qt_policy(), Qt CMake policies, qt_generate_deploy_app_script(), and qt_deploy_runtime_dependencies().

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