summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/src/cmake/qt_policy.qdoc
blob: 6deb7a729cbfa55707427df05492c840bf9e06d1 (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
64
65
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
\page qt-policy.html
\ingroup cmake-commands-qtcore

\title qt_policy
\keyword qt6_policy

\summary {Modify the default behavior of Qt's CMake API.}

\include cmake-find-package-core.qdocinc

\cmakecommandsince 6.5

\section1 Synopsis

\badcode
qt_policy(
    [SET <policy_name> behavior]
    [GET <policy_name> <variable>]
)
\endcode

\versionlessCMakeCommandsNote qt6_policy()

\section1 Description

This command has two modes:

\list
\li When the \c{SET} keyword is used, this command can be used to opt in to
    behavior changes in Qt's CMake API, or to explicitly opt out of them.
\li When the \c{GET} keyword is used, \c{<variable>} is set to the current
    behavior for the policy, i.e. \c OLD or \c NEW.
\endlist

\c{<policy_name>} must be the name of one of the \l{Qt CMake policies}.
Policy names have the form of \c{QTP<NNNN>} where <NNNN> is
an integer specifying the index of the policy. Using an invalid policy
name results in an error.

Code supporting older Qt versions can check the existence of a policy by
checking the value of the \c{QT_KNOWN_POLICY_<policy_name>} variable before
getting the value of \c <policy_name> or setting its behavior.

\badcode
if(QT_KNOWN_POLICY_<policy_name>)
    qt_policy(SET <policy_name> NEW)
endif()
\endcode

You can set \c behavior to one of the following options:

\list
\li \c{NEW} to opt into the new behavior
\li \c{OLD} to explicitly opt-out of it
\endlist

\qtpolicydeprecatedbehavior

\sa qt_standard_project_setup

*/