diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index 6d02b6136a9..be00bae347d 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -432,8 +432,17 @@ function(qt6_android_add_apk_target target) if(QT_ENABLE_VERBOSE_DEPLOYMENT) list(APPEND extra_args "--verbose") endif() - if(QT_ANDROID_DEPLOY_RELEASE) - list(APPEND extra_args "--release") + + if(QT_ANDROID_DEPLOY_RELEASE) # legacy opt-in variable + set(QT_ANDROID_DEPLOYMENT_TYPE "RELEASE") + endif() + # Setting QT_ANDROID_DEPLOYMENT_TYPE to a value other than Release disables + # release package signing regardless of the build type. + if(QT_ANDROID_DEPLOYMENT_TYPE) + string(TOUPPER "${QT_ANDROID_DEPLOYMENT_TYPE}" deployment_type_upper) + if("${deployment_type_upper}" STREQUAL "RELEASE") + list(APPEND extra_args "--release") + endif() elseif(NOT QT_BUILD_TESTS) # Workaround for tests: do not set automatically --release flag if QT_BUILD_TESTS is set. # Release package need to be signed. Signing is currently not supported by CI. diff --git a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc index dd5800a4114..a7b9a941484 100644 --- a/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc +++ b/src/corelib/doc/src/cmake/cmake-configure-variables.qdoc @@ -86,14 +86,39 @@ is written out as part of the deployment settings for a target. \title QT_ANDROID_DEPLOY_RELEASE \target cmake-variable-QT_ANDROID_DEPLOY_RELEASE -\summary {Sets the package type as a release.} +\summary {Forces release package signing regardless of the build type.} \cmakevariablesince 6.5.2 \preliminarycmakevariable \cmakevariableandroidonly -When set to \c TRUE, allows you to create a release package -by passing the \c --release flag to the \c androiddeployqt tool. +When set to \c TRUE, the \c --release flag is passed to the \c androiddeployqt +tool, even when the application build mode is Debug. In Release and +RelWithDebInfo builds this is the default. For more control over this, prefer +using \l QT_ANDROID_DEPLOYMENT_TYPE instead. + +\sa {androiddeployqt} +*/ + +/*! +\page cmake-variable-qt-android-deployment-type.html +\ingroup cmake-variables-qtcore + +\title QT_ANDROID_DEPLOYMENT_TYPE +\target cmake-variable-QT_ANDROID_DEPLOYMENT_TYPE + +\summary {Forces or disables release package signing regardless of the build type.} + +\cmakevariablesince 6.7 +\preliminarycmakevariable +\cmakevariableandroidonly + +When set to \c Release, the \c --release flag is passed to the \c +androiddeployqt tool, regardless of the application build type. When set to +another value, the \c --release flag is never passed to the tool, which +effectively disables release package signing even in Release or RelWithDebInfo +builds. When not set, the default behavior is to use release package signing in +build types other than Debug. \sa {androiddeployqt} */