QTP0002

Target properties that specify Android-specific paths may contain generator expressions.

This policy was introduced in Qt 6.6. It changes the processing of target properties that specify Android-specific paths:

The OLD behavior of this policy doesn't allow generator expressions in the target properties that specify Android-specific paths but implicitly converts the specified paths to valid JSON strings.

The NEW behavior of this policy allows using generator expressions in the target properties that specify Android-specific paths, but they must evaluate to valid JSON strings.

The following value of the QT_ANDROID_EXTRA_PLUGINS property is converted to a valid JSON string if you set the policy to OLD, but leads to an error if the policy is set to NEW:

 set_target_properties(
     QT_ANDROID_EXTRA_PLUGINS "\\path\\to\\MyPlugin.so"
 )

If the policy is set to NEW for the above example, the resulting JSON string in the deployment settings file will contain escaped symbols instead of path separators.

Generator expressions are only supported if the policy is set to NEW, so the OLD behavior generates a malformed deployment settings file with the following code:

 set_target_properties(
     QT_ANDROID_EXTRA_PLUGINS "$<TARGET_FILE_DIR:MyPlugin>"
 )

This property value works as expected with both OLD and NEW policy values:

 set_target_properties(
     QT_ANDROID_EXTRA_PLUGINS "/path/to/MyPlugin.so"
 )

Note: The OLD behavior of a policy is deprecated, and may be removed in the future.

See also qt_policy and Qt CMake policies.