From 1180d5b8a270cfe7bd1c501c892d1c38ee7425de Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 6 Dec 2022 16:12:12 +0100 Subject: [PATCH] CMake: Add Android build information to generated module .json files Qt Creator maintains a mapping from Qt version to Android NDK version and other build information. It's simpler to let the Qt build write the Android build information into modules/Core.json and have Qt Creator use this information. This adds the following properties to the module JSON files: - built_with.android.api_version - built_with.android.ndk.version Task-number: QTBUG-108292 Change-Id: I0febda5192289c5afb1a098880b31bef6317db35 Reviewed-by: Marcus Tillmanns Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor --- cmake/ModuleDescription.json.in | 2 +- cmake/QtModuleHelpers.cmake | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/ModuleDescription.json.in b/cmake/ModuleDescription.json.in index 6aae9a4a591..ab5f4e304ac 100644 --- a/cmake/ModuleDescription.json.in +++ b/cmake/ModuleDescription.json.in @@ -1,7 +1,7 @@ { "module_name": "${target}", "version": "${PROJECT_VERSION}", - "built_with": { + "built_with": {${extra_build_information} "compiler_id": "${CMAKE_CXX_COMPILER_ID}", "compiler_target": "${CMAKE_CXX_COMPILER_TARGET}", "compiler_version": "${CMAKE_CXX_COMPILER_VERSION}", diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 59340222bb9..9a9e3bec1d3 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -1021,6 +1021,16 @@ function(qt_describe_module target) if(CMAKE_CROSSCOMPILING) set(cross_compilation "true") endif() + set(extra_build_information "") + if(ANDROID) + string(APPEND extra_build_information " + \"android\": { + \"api_version\": \"${QT_ANDROID_API_VERSION}\", + \"ndk\": { + \"version\": \"${ANDROID_NDK_REVISION}\" + } + },") + endif() configure_file("${descfile_in}" "${descfile_out}") qt_install(FILES "${descfile_out}" DESTINATION "${install_dir}")