1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
6\ingroup cmake-commands-qtcore
11\summary {Modify the default behavior of Qt's CMake API.}
13\include cmake-find-package-core.qdocinc
21 [SET <policy_name> behavior]
22 [GET <policy_name> <variable>]
26\versionlessCMakeCommandsNote qt6_policy()
30This command has two modes:
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.
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.
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.
49if(QT_KNOWN_POLICY_<policy_name>)
50 qt_policy(SET <policy_name> NEW)
54You can set \c behavior to one of the following options:
57\li \c{NEW} to opt into the new behavior
58\li \c{OLD} to explicitly opt-out of it
61\qtpolicydeprecatedbehavior
63\sa qt_standard_project_setup