Modify the default behavior of Qt's CMake API.
The command is defined in the Core component of the Qt6 package, which can be loaded like so:
find_package(Qt6 REQUIRED COMPONENTS Core)
This command was introduced in Qt 6.5.
qt_policy(
[SET <policy_name> behavior]
[GET <policy_name> <variable>]
)
If versionless commands are disabled, use qt6_policy() instead. It supports the same set of arguments as this
command.
This command has two modes:
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.GET keyword is used, <variable> is set to the current behavior for the policy, i.e. OLD or NEW.<policy_name> must be the name of one of the Qt CMake policies. Policy names have the form of 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 QT_KNOWN_POLICY_<policy_name> variable before getting the value of <policy_name> or setting its behavior.
if(QT_KNOWN_POLICY_<policy_name>)
qt_policy(SET <policy_name> NEW)
endif()
You can set behavior to one of the following options:
NEW to opt into the new behaviorOLD to explicitly opt-out of itNote: The OLD behavior of a policy is deprecated, and may be removed in the future.
See also qt_standard_project_setup.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: