From b171abe69533a83c5b6fea51807da3ad45a1d3f3 Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Mon, 16 Jan 2023 16:05:57 +0100 Subject: [PATCH] Remove GENERATE_METATYPES It doesn't seem like that it is being used anymore, except an instance in pro2cmake which I replaced by NO_GENERATE_METATYPES. Pick-to: 6.5 Change-Id: I135cf47e6041e98b354fb684f0079dad30689dea Reviewed-by: Alexandru Croitor --- cmake/QtModuleHelpers.cmake | 24 ++++++++---------------- src/corelib/CMakeLists.txt | 3 ++- util/cmake/pro2cmake.py | 4 ++-- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index 9ce689a6382..cbe8defaf86 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -17,7 +17,6 @@ macro(qt_internal_get_internal_add_module_keywords option_args single_args multi NO_GENERATE_METATYPES NO_HEADERSCLEAN_CHECK GENERATE_CPP_EXPORTS - GENERATE_METATYPES # TODO: Remove once it is not used anymore GENERATE_PRIVATE_CPP_EXPORTS ) set(${single_args} @@ -706,23 +705,16 @@ set(QT_ALLOW_MISSING_TOOLS_PACKAGES TRUE)") endif() # Generate metatypes - if(${arg_GENERATE_METATYPES}) - # No mention of NO_GENERATE_METATYPES. You should not use it. - message(WARNING "GENERATE_METATYPES is on by default for Qt modules. Please remove the manual specification.") - endif() - if (NOT ${arg_NO_GENERATE_METATYPES}) - if (NOT target_type STREQUAL "INTERFACE_LIBRARY") - set(args "") - if(QT_WILL_INSTALL) - set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes") - list(APPEND args - __QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}") - endif() - qt6_extract_metatypes(${target} ${args}) - elseif(${arg_GENERATE_METATYPES}) - message(FATAL_ERROR "Meta types generation does not work on interface libraries") + if (NOT ${arg_NO_GENERATE_METATYPES} AND NOT target_type STREQUAL "INTERFACE_LIBRARY") + set(args "") + if(QT_WILL_INSTALL) + set(metatypes_install_dir "${INSTALL_ARCHDATADIR}/metatypes") + list(APPEND args + __QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}") endif() + qt6_extract_metatypes(${target} ${args}) endif() + qt_internal_get_min_new_policy_cmake_version(min_new_policy_version) qt_internal_get_max_new_policy_cmake_version(max_new_policy_version) configure_package_config_file( diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index d2862ff5327..23e56567887 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -390,7 +390,8 @@ if(QT_WILL_INSTALL) list(APPEND core_metatype_args __QT_INTERNAL_INSTALL __QT_INTERNAL_INSTALL_DIR "${metatypes_install_dir}") endif() -# Use qt6_extract_metatypes instead of GENERATE_METATYPES so that we can manually pass the + +# Use qt6_extract_metatypes instead so that we can manually pass the # additional json files. qt6_extract_metatypes(Core ${core_metatype_args}) diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 487a57abd69..e28d7c04eb5 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -3569,8 +3569,8 @@ def write_module(cm_fh: IO[str], scope: Scope, *, indent: int = 0) -> str: scope._has_private_module = True if "header_module" in scope.get("CONFIG"): extra.append("HEADER_MODULE") - if "metatypes" in scope.get("CONFIG") or "qmltypes" in scope.get("CONFIG"): - extra.append("GENERATE_METATYPES") + if not("metatypes" in scope.get("CONFIG") or "qmltypes" in scope.get("CONFIG")): + extra.append("NO_GENERATE_METATYPES") module_config = scope.get("MODULE_CONFIG") if len(module_config):