QTP0002
指定 Android 特定路径的目标属性可包含生成器表达式。
此策略在 Qt 6.6 中引入。它改变了对指定 Android 特定路径的目标属性的处理:
- qt_qml_import_path
- qt_qml_root_path
- qt_android_package_source_dir
- qt_android_extra_plugins
- qt_android_extra_libs
该策略的OLD
行为不允许在目标属性中使用指定 Android 特定路径的生成器表达式,但会隐式地将指定路径转换为有效的 JSON 字符串。
该策略的NEW
行为允许在目标属性中使用指定 Android 特定路径的生成器表达式,但它们必须求值为有效的 JSON 字符串。
如果将策略设置为 OLD,QT_ANDROID_EXTRA_PLUGINS属性的以下值将转换为有效的 JSON 字符串,但如果将策略设置为 NEW,则会导致错误:
set_target_properties( QT_ANDROID_EXTRA_PLUGINS "\\path\\to\\MyPlugin.so" )
如果在上述示例中将策略设置为新,部署设置文件中生成的 JSON 字符串将包含转义符而不是路径分隔符。
生成器表达式只有在策略设置为 "新 "时才受支持,因此 "旧 "行为会生成包含以下代码的畸形部署设置文件:
set_target_properties( QT_ANDROID_EXTRA_PLUGINS "$<TARGET_FILE_DIR:MyPlugin>" )
该属性值对 OLD 和 NEW 策略值均有效:
set_target_properties( QT_ANDROID_EXTRA_PLUGINS "/path/to/MyPlugin.so" )
注: OLD
策略行为已被弃用,将来可能会被移除。
另请参阅 qt_policy和Qt CMake 策略。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.