From 524b957d1f7d616ce511f424f78b8d5e37091787 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 7 Jun 2021 17:14:39 +0200 Subject: [PATCH] CMake: Fix global 'apk' target to apply to Qt EXTERNAL_BUILD examples This means calling 'ninja apk' in a Qt build with examples configured will build all example apks, regardless of whether the examples are built as external projects or in-tree. Fixes: QTBUG-94264 Change-Id: I5c7af0354858898a2e154a6d54fb025e4d81ff80 Reviewed-by: Joerg Bornemann Reviewed-by: Qt CI Bot --- .../QtBuildInternalsConfig.cmake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake index 1de583ac2d..2ed51f5685 100644 --- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake +++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake @@ -905,6 +905,23 @@ function(qt_internal_add_example subdir) ${independent_args} ) + # Create an apk external project step and custom target that invokes the apk target + # within the external project. + # Make the global apk target depend on that custom target. + if(ANDROID) + ExternalProject_Add_Step(${arg_NAME} apk + COMMAND ${CMAKE_COMMAND} --build --target apk + DEPENDEES configure + EXCLUDE_FROM_MAIN YES + ${terminal_args} + ) + ExternalProject_Add_StepTargets(${arg_NAME} apk) + + if(TARGET apk) + add_dependencies(apk ${arg_NAME}-apk) + endif() + endif() + cmake_policy(POP) string(TOLOWER ${PROJECT_NAME} project_name_lower)