Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qt_policy.qdoc
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt-policy.html
6\ingroup cmake-commands-qtcore
7
8\title qt_policy
9\keyword qt6_policy
10
11\summary {Modify the default behavior of Qt's CMake API.}
12
13\include cmake-find-package-core.qdocinc
14
15\cmakecommandsince 6.5
16
17\section1 Synopsis
18
19\badcode
20qt_policy(
21 [SET <policy_name> behavior]
22 [GET <policy_name> <variable>]
23)
24\endcode
25
26\versionlessCMakeCommandsNote qt6_policy()
27
28\section1 Description
29
30This command has two modes:
31
32\list
33\li When the \c{SET} keyword is used, this command can be used to opt in to
34 behavior changes in Qt's CMake API, or to explicitly opt out of them.
35\li When the \c{GET} keyword is used, \c{<variable>} is set to the current
36 behavior for the policy, i.e. \c OLD or \c NEW.
37\endlist
38
39\c{<policy_name>} must be the name of one of the \l{Qt CMake policies}.
40Policy names have the form of \c{QTP<NNNN>} where <NNNN> is
41an integer specifying the index of the policy. Using an invalid policy
42name results in an error.
43
44Code supporting older Qt versions can check the existence of a policy by
45checking the value of the \c{QT_KNOWN_POLICY_<policy_name>} variable before
46getting the value of \c <policy_name> or setting its behavior.
47
48\badcode
49if(QT_KNOWN_POLICY_<policy_name>)
50 qt_policy(SET <policy_name> NEW)
51endif()
52\endcode
53
54You can set \c behavior to one of the following options:
55
56\list
57\li \c{NEW} to opt into the new behavior
58\li \c{OLD} to explicitly opt-out of it
59\endlist
60
61\qtpolicydeprecatedbehavior
62
63\sa qt_standard_project_setup
64
65*/