Skip to content

Commit

Permalink
Allow calling qt6_android_add_apk_target twice
Browse files Browse the repository at this point in the history
If qt6_android_add_apk_target is called manually in user project this
might cause duplicated targets issue when calling the finalizer(either
manually or in a defer call).
Skip the qt6_android_add_apk_target body if target is already
registered in _qt_apk_targets list.

Pick-to: 6.3
Change-Id: I36ef569227e0c5f0f077446bbe5d7e8d8fc0bfc6
Reviewed-by: Alexandru Croitor <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
  • Loading branch information
semlanik committed Feb 24, 2022
1 parent bb209b5 commit 708eb85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/corelib/Qt6AndroidMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ endif()

# Add custom target to package the APK
function(qt6_android_add_apk_target target)
# Avoid calling qt6_android_add_apk_target twice
get_property(apk_targets GLOBAL PROPERTY _qt_apk_targets)
if("${target}" IN_LIST apk_targets)
return()
endif()

get_target_property(deployment_file ${target} QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
if (NOT deployment_file)
message(FATAL_ERROR "Target ${target} is not a valid android executable target\n")
Expand Down

0 comments on commit 708eb85

Please sign in to comment.