summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/cmake/policy/qtp0002.qdoc
blob: a40344a167569c650ba9e3b09e8dada94b51543b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qt-cmake-policy-qtp0002.html
\ingroup qt-cmake-policies

\title QTP0002
\keyword qt_cmake_policy_qtp0002

\summary {Target properties that specify Android-specific paths may contain generator expressions.}

This policy was introduced in Qt 6.6. It changes the processing of target
properties that specify Android-specific paths:
\list
    \li \l QT_QML_IMPORT_PATH
    \li \l QT_QML_ROOT_PATH
    \li \l QT_ANDROID_PACKAGE_SOURCE_DIR
    \li \l QT_ANDROID_EXTRA_PLUGINS
    \li \l QT_ANDROID_EXTRA_LIBS
\endlist

The \c OLD behavior of this policy doesn't allow generator expressions in the
target properties that specify Android-specific paths but implicitly converts
the specified paths to valid JSON strings.

The \c NEW behavior of this policy allows using generator expressions in the
target properties that specify Android-specific paths, but they must evaluate to
valid JSON strings.

The following value of the \l QT_ANDROID_EXTRA_PLUGINS property is converted to
a valid JSON string if you set the policy to OLD, but leads to an error if the
policy is set to NEW:
\badcode
set_target_properties(
    QT_ANDROID_EXTRA_PLUGINS "\\path\\to\\MyPlugin.so"
)
\endcode
If the policy is set to NEW for the above example, the resulting JSON string in
the deployment settings file will contain escaped symbols instead of path
separators.

Generator expressions are only supported if the policy is set to NEW, so the
OLD behavior generates a malformed deployment settings file with the following
code:
\badcode
set_target_properties(
    QT_ANDROID_EXTRA_PLUGINS "$<TARGET_FILE_DIR:MyPlugin>"
)
\endcode

This property value works as expected with both OLD and NEW policy values:
\badcode
set_target_properties(
    QT_ANDROID_EXTRA_PLUGINS "/path/to/MyPlugin.so"
)
\endcode

\qtpolicydeprecatedbehavior

\sa qt_policy, {Qt CMake policies}

*/