From c6a471697422b9f251dcfd70dce9339bf745cae9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Apr 2021 12:14:46 +0200 Subject: [PATCH] Add QT_ANDROID_VERSION_{NAME|CODE} target properties Those are the CMake counterparts of the qmake variables ANDROID_VERSION_{NAME|CODE}. Task-number: QTBUG-86033 Change-Id: I57534ff04db0c78871fe7ba81bedaf377422054b Reviewed-by: Assam Boudjelthia (cherry picked from commit 8fdaa081fdf1749fabf23dcb4b9b07e800b785a0) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/Qt6AndroidMacros.cmake | 14 ++++++-- src/corelib/doc/src/cmake-macros.qdoc | 2 ++ src/corelib/doc/src/cmake-properties.qdoc | 42 +++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index c520242d063..182d0045754 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -147,9 +147,19 @@ function(qt6_android_generate_deployment_settings target) " \"android-package-source-directory\": \"${android_package_source_dir_native}\",\n") endif() - #TODO: ANDROID_VERSION_NAME, doesn't seem to be used? + # version code + get_target_property(android_version_code ${target} QT_ANDROID_VERSION_CODE) + if (android_version_code) + string(APPEND file_contents + " \"android-version-code\": \"${android_version_code}\",\n") + endif() - #TODO: ANDROID_VERSION_CODE, doesn't seem to be used? + # version name + get_target_property(android_version_name ${target} QT_ANDROID_VERSION_NAME) + if (android_version_name) + string(APPEND file_contents + " \"android-version-name\": \"${android_version_name}\",\n") + endif() get_target_property(qml_import_path ${target} QT_QML_IMPORT_PATH) if (qml_import_path) diff --git a/src/corelib/doc/src/cmake-macros.qdoc b/src/corelib/doc/src/cmake-macros.qdoc index d14fc5badbd..53aebfba172 100644 --- a/src/corelib/doc/src/cmake-macros.qdoc +++ b/src/corelib/doc/src/cmake-macros.qdoc @@ -529,6 +529,8 @@ how to accomplish this. \li \l{cmake-target-property-QT_ANDROID_EXTRA_LIBS}{QT_ANDROID_EXTRA_LIBS} \li \l{cmake-target-property-QT_ANDROID_EXTRA_PLUGINS}{QT_ANDROID_EXTRA_PLUGINS} \li \l{cmake-target-property-QT_ANDROID_PACKAGE_SOURCE_DIR}{QT_ANDROID_PACKAGE_SOURCE_DIR} +\li \l{cmake-target-property-QT_ANDROID_VERSION_NAME}{QT_ANDROID_VERSION_NAME} +\li \l{cmake-target-property-QT_ANDROID_VERSION_CODE}{QT_ANDROID_VERSION_CODE} \li \l{cmake-target-property-QT_QML_IMPORT_PATH}{QT_QML_IMPORT_PATH} \li \l{cmake-target-property-QT_QML_ROOT_PATH}{QT_QML_ROOT_PATH} \li \l{cmake-target-property-qt_no_entrypoint}{qt_no_entrypoint} diff --git a/src/corelib/doc/src/cmake-properties.qdoc b/src/corelib/doc/src/cmake-properties.qdoc index 87809dcd081..5887875cab6 100644 --- a/src/corelib/doc/src/cmake-properties.qdoc +++ b/src/corelib/doc/src/cmake-properties.qdoc @@ -143,6 +143,48 @@ then place this directly into the directory specified by this variable. \sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} */ +/*! +\page cmake-target-property-QT_ANDROID_VERSION_CODE.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_VERSION_CODE +\target cmake-target-property-QT_ANDROID_VERSION_CODE + +\brief Internal Android app version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the app's version number. This is usually a number that +increments monotonically with each release of your project. + +For more information, see \l{Android: App Versioning}{Android App Versioning}. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + +/*! +\page cmake-target-property-QT_ANDROID_VERSION_NAME.html +\ingroup cmake-properties-qtcore +\ingroup cmake-target-properties-qtcore + +\title QT_ANDROID_VERSION_NAME +\target cmake-target-property-QT_ANDROID_VERSION_NAME + +\brief Human-readable Android app version. + +\preliminarycmakeproperty +\cmakepropertyandroidonly + +Specifies the app's version as a human readable string, usually three +numbers, separated by dots. + +For more information, see \l{Android: App Versioning}{Android App Versioning}. + +\sa{qt6_android_generate_deployment_settings}{qt_android_generate_deployment_settings()} +*/ + /*! \page cmake-target-property-QT_QML_ROOT_PATH.html \ingroup cmake-properties-qtcore