From 575b8a7fa289a2e27984a6c322069f9e1b499024 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 19 Jul 2023 17:57:01 +0200 Subject: [PATCH] Check the QTP0002 policy only if paths are set It doesn't make sense to disturb users with the policy warning if they don't specify Android paths. Suppress the policy check if Android paths are not set for the target. Fixes: QTBUG-115119 Pick-to: 6.6 Change-Id: Ice9d0459c01feb505857133bb942b1b6e775e55a Reviewed-by: Alexandru Croitor --- src/corelib/Qt6AndroidMacros.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index c7e31f621f..3ba7675f4a 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -901,6 +901,28 @@ function(_qt_internal_android_format_deployment_paths target) if(QT_BUILD_STANDALONE_TESTS OR QT_BUILDING_QT OR QT_INTERNAL_IS_STANDALONE_TEST) set(android_deployment_paths_policy NEW) else() + set(policy_path_properties + QT_QML_IMPORT_PATH + QT_QML_ROOT_PATH + QT_ANDROID_PACKAGE_SOURCE_DIR + QT_ANDROID_EXTRA_PLUGINS + QT_ANDROID_EXTRA_LIBS + ) + + # Check if any of paths contains the value and stop the evaluation if all properties are + # empty or -NOTFOUND + set(has_android_paths FALSE) + foreach(prop_name IN LISTS policy_path_properties) + get_target_property(prop_value ${target} prop_name) + if(prop_value) + set(has_android_paths TRUE) + break() + endif() + endforeach() + if(NOT has_android_paths) + return() + endif() + __qt_internal_setup_policy(QTP0002 "6.6.0" "Target properties that specify android-specific paths may contain generator\ expressions but they must evaluate to valid JSON strings.\