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
qtp0008.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-qtp0008.html
6\ingroup qt-cmake-policies
7\since 6.12
8\title QTP0008
9\keyword qt_cmake_policy_qtp0008
10
11\summary {Forwards deploy script arguments without re-evaluating them.}
12
13This policy was introduced in Qt 6.12. The policy affects how the version-less
14\l{qt_generate_deploy_script()} and \l{qt_generate_deploy_app_script()} commands pass
15their arguments to the implementation code.
16
17Both commands used to be macros. A macro substitutes its arguments textually and
18the result is parsed again, so escape sequences and \c{${}} references in the
19argument values were evaluated a second time. Projects had to escape such values
20twice to compensate.
21
22If the policy is set to \c OLD, the values are forwarded through a macro, so they
23are re-evaluated the way they used to be.
24
25If the policy is set to \c NEW, the values are forwarded through a function, so
26they remain unchanged.
27
28When the policy is not set, the values are re-evaluated as with \c OLD, and an
29\c{AUTHOR_WARNING} is emitted, but only if the re-evaluation actually changes one
30of the values. The warning shows the values before and after, so that it is clear
31what has to be adapted.
32
33Consider the code snippet below:
34\badcode
35qt_generate_deploy_script(
36 OUTPUT_SCRIPT deploy_script
37 CONTENT "
38qt_deploy_qt_conf(\"\${QT_DEPLOY_PREFIX}/qt.conf\")
39"
40)
41\endcode
42
43With the policy unset or \c OLD, the reference is expanded while the arguments are
44forwarded, and the generated script ends up with \c{qt_deploy_qt_conf("/qt.conf")}.
45With the policy set to \c NEW, the reference reaches the generated script and is
46expanded when that script runs.
47
48A forwarded value that contains an invalid backslash escape will fail
49at command invocation while the policy is unset or \c OLD.
50An \c{AUTHOR_WARNING} is emitted referencing this policy before the error is
51reported by CMake.
52
53\qtpolicydeprecatedbehavior
54
55\sa qt_policy(), {Qt CMake policies}, qt_generate_deploy_script(),
56 qt_generate_deploy_app_script()
57
58*/