diff --git a/cmake/ModuleDescription.json.in b/cmake/ModuleDescription.json.in index 61b8d931c3c..4d07bfae46f 100644 --- a/cmake/ModuleDescription.json.in +++ b/cmake/ModuleDescription.json.in @@ -1,6 +1,7 @@ { "name": "${target}", - "version": "${PROJECT_VERSION}", + "repository": "${lower_case_project_name}", + "version": "${PROJECT_VERSION}",${extra_module_information} "built_with": {${extra_build_information} "compiler_id": "${CMAKE_CXX_COMPILER_ID}", "compiler_target": "${CMAKE_CXX_COMPILER_TARGET}", diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 187f15e99c0..947adb8cece 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -1030,6 +1030,17 @@ the different base name for the module info variables.") "${${result}_install_interface_qpa_include_dir}" PARENT_SCOPE) endfunction() +function(qt_internal_list_to_json_array out_var list_var) + set(result "") + foreach(item IN LISTS ${list_var}) + if(NOT "${result}" STREQUAL "") + string(APPEND result ", ") + endif() + string(APPEND result "\"${item}\"") + endforeach() + set("${out_var}" "[${result}]" PARENT_SCOPE) +endfunction() + # Generate a module description file based on the template in ModuleDescription.json.in function(qt_describe_module target) set(path_suffix "${INSTALL_DESCRIPTIONSDIR}") @@ -1038,10 +1049,22 @@ function(qt_describe_module target) set(descfile_in "${QT_CMAKE_DIR}/ModuleDescription.json.in") set(descfile_out "${build_dir}/${target}.json") + string(TOLOWER "${PROJECT_NAME}" lower_case_project_name) set(cross_compilation "false") if(CMAKE_CROSSCOMPILING) set(cross_compilation "true") endif() + set(extra_module_information "") + + get_target_property(target_type ${target} TYPE) + if(NOT target_type STREQUAL "INTERFACE_LIBRARY") + get_target_property(plugin_types ${target} MODULE_PLUGIN_TYPES) + if(plugin_types) + qt_internal_list_to_json_array(plugin_types plugin_types) + string(APPEND extra_module_information "\n \"plugin_types\": ${plugin_types},") + endif() + endif() + set(extra_build_information "") if(ANDROID) string(APPEND extra_build_information "