// 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 behavior] [GET ] ) \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{} is set to the current behavior for the policy, i.e. \c OLD or \c NEW. \endlist \c{} must be the name of one of the \l{Qt CMake policies}. Policy names have the form of \c{QTP} where 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_} variable before getting the value of \c or setting its behavior. \badcode if(QT_KNOWN_POLICY_) qt_policy(SET 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 */