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
13
This 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
15
to \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
17
generates.
18
19
If the policy is set to \c OLD, the values are written unquoted. When the
20
generated script runs, cmake splits each value at whitespace and interprets
21
backslashes in it as escape sequences. This causes issues with values that
22
contain whitespace, backslashes or double quotes.
23
24
If the policy is set to \c NEW, each value is written as a quoted argument, with
25
backslashes and double quotes escaped, so that the value reaches
26
\l{qt_deploy_runtime_dependencies()} unchanged.
27
28
When the policy is not set and a forwarded value contains whitespace, a backslash
29
or a double quote, an \c{AUTHOR_WARNING} is emitted and the values are written
30
unquoted for backwards compatibility. Values without those characters are
31
unaffected, so no warning is emitted for them.
32
33
For example, a code signing identity that contains spaces:
34
\badcode
35
# QTP0007 not set - AUTHOR_WARNING is emitted
36
qt_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
43
The identity reaches \c macdeployqt as several arguments, and the code signing
44
step either picks the wrong identity or fails. Setting the policy to \c NEW
45
passes it on as a single argument:
46
\badcode
47
qt_policy(SET QTP0007 NEW)
48
qt_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
55
Note that a project which put several options into one whitespace-separated
56
value relied on the \c OLD behavior to split them, and has to pass them as
57
separate 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.
60
set(options "-hardened-runtime -timestamp -appstore-compliant -verbose=3")
61
\endcode
62
\badcode
63
# Correct way to pass options with the \c NEW behavior.
64
set(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
*/
qtbase
src
corelib
doc
src
cmake
policy
qtp0007.qdoc
Generated on
for Qt by
1.16.1