Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtp0007.qdoc
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-cmake-policy-qtp0007.html
6\ingroup qt-cmake-policies
7\since 6.12
8\title QTP0007
9\keyword qt_cmake_policy_qtp0007
10
11\summary {Quotes and escapes forwarded argument values in generated deploy scripts.}
12
13This policy was introduced in Qt 6.12. The policy affects how
14\l{qt_generate_deploy_app_script()} writes the values of the keywords it forwards
15to \l{qt_deploy_runtime_dependencies()}, such as \c{DEPLOY_TOOL_OPTIONS},
16\c{PRE_EXCLUDE_REGEXES} and \c{POST_EXCLUDE_FILES}, into the deploy script it
17generates.
18
19If the policy is set to \c OLD, the values are written unquoted. When the
20generated script runs, cmake splits each value at whitespace and interprets
21backslashes in it as escape sequences. This causes issues with values that
22contain whitespace, backslashes or double quotes.
23
24If the policy is set to \c NEW, each value is written as a quoted argument, with
25backslashes and double quotes escaped, so that the value reaches
26\l{qt_deploy_runtime_dependencies()} unchanged.
27
28When the policy is not set and a forwarded value contains whitespace, a backslash
29or a double quote, an \c{AUTHOR_WARNING} is emitted and the values are written
30unquoted for backwards compatibility. Values without those characters are
31unaffected, so no warning is emitted for them.
32
33For example, a code signing identity that contains spaces:
34\badcode
35# QTP0007 not set - AUTHOR_WARNING is emitted
36qt_generate_deploy_app_script(
37 TARGET MyApp
38 OUTPUT_SCRIPT deploy_script
39 DEPLOY_TOOL_OPTIONS "-codesign=Developer ID Application: Foo"
40)
41\endcode
42
43The identity reaches \c macdeployqt as several arguments, and the code signing
44step either picks the wrong identity or fails. Setting the policy to \c NEW
45passes it on as a single argument:
46\badcode
47qt_policy(SET QTP0007 NEW)
48qt_generate_deploy_app_script(
49 TARGET MyApp
50 OUTPUT_SCRIPT deploy_script
51 DEPLOY_TOOL_OPTIONS "-codesign=Developer ID Application: Foo"
52)
53\endcode
54
55Note that a project which put several options into one whitespace-separated
56value relied on the \c OLD behavior to split them, and has to pass them as
57separate list elements once the policy is set to \c NEW:
58\badcode
59# Relies on the \c OLD behavior to split the value into four options.
60set(options "-hardened-runtime -timestamp -appstore-compliant -verbose=3")
61\endcode
62\badcode
63# Correct way to pass options with the \c NEW behavior.
64set(options -hardened-runtime -timestamp -appstore-compliant -verbose=3)
65\endcode
66
67\qtpolicydeprecatedbehavior
68
69\sa qt_policy(), {Qt CMake policies}, qt_generate_deploy_app_script(),
70 qt_deploy_runtime_dependencies()
71
72*/