diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-05-24 13:10:26 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2022-05-31 17:23:09 +0200 |
commit | 86fae5664cbcaf9e6f98eca984564e5452730abd (patch) | |
tree | c5bea65da2a07ae6fab093aa4076741964b788d9 /src/qml/Qt6QmlBuildInternals.cmake | |
parent | 375a55d019d16afde1e611a9ac0d399887821400 (diff) |
Remove qmltc compilation command in favor of qt_add_qml_module()
[ChangeLog][CMake] The qmltc compilation functionality provided by
qt6_target_compile_qml_to_cpp() is merged into qt6_add_qml_module()
command and is available through ENABLE_TYPE_COMPILER argument. The
qt6_target_compile_qml_to_cpp() function does nothing and is left
only to highlight that users must migrate away from it.
Fixes: QTBUG-100215
Change-Id: Ie7d6b82564dff86176194fce35039ba0d93c0977
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlBuildInternals.cmake')
-rw-r--r-- | src/qml/Qt6QmlBuildInternals.cmake | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/src/qml/Qt6QmlBuildInternals.cmake b/src/qml/Qt6QmlBuildInternals.cmake index ad42596931..7ff542b7c7 100644 --- a/src/qml/Qt6QmlBuildInternals.cmake +++ b/src/qml/Qt6QmlBuildInternals.cmake @@ -18,6 +18,7 @@ macro(qt_internal_get_internal_add_qml_module_keywords NO_GENERATE_QMLDIR NO_LINT NO_CACHEGEN + ENABLE_TYPE_COMPILER __QT_INTERNAL_STATIC_MODULE __QT_INTERNAL_SYSTEM_MODULE ) @@ -29,6 +30,7 @@ macro(qt_internal_get_internal_add_qml_module_keywords CLASS_NAME CLASSNAME # TODO: Remove once all other repos have been updated to use # CLASS_NAME instead. + TYPE_COMPILER_NAMESPACE ) set(${multi_args} QML_FILES @@ -306,6 +308,11 @@ function(qt_internal_add_qml_module target) list(APPEND add_qml_module_args NAMESPACE ${qt_namespace}) endif() + if (arg_ENABLE_TYPE_COMPILER AND NOT arg_TYPE_COMPILER_NAMESPACE) + # if qmltc namespace is not specified explicitly, use Qt's namespace + list(APPEND add_qml_module_args TYPE_COMPILER_NAMESPACE ${qt_namespace}) + endif() + # Update the backing and plugin targets with qml-specific things. qt6_add_qml_module(${target} ${add_qml_module_args} @@ -437,55 +444,3 @@ function(qt_internal_add_qml_module target) endif() endif() endfunction() - -# This function is an internal wrapper around qt6_target_compile_qml_to_cpp(). -# It sets up some pre-defined Qt-specific arguments when calling the -# qt6_target_compile_qml_to_cpp(). All keywords supported by -# qt6_target_compile_qml_to_cpp() can be used. -# -# Unlike the public command version, the following changes are present: -# - NAMESPACE argument is set to QT_NAMESPACE by default -# -# See qt6_target_compile_qml_to_cpp() for the full set of supported keywords. -function(qt_internal_target_compile_qml_to_cpp target) - set(option_args "") - set(single_args NAMESPACE) - set(multi_args QML_FILES IMPORT_PATHS) - qt_parse_all_arguments(arg "qt_internal_target_compile_qml_to_cpp" - "${option_args}" - "${single_args}" - "${multi_args}" - ${ARGN} - ) - - # internal-only logic: - if(NOT arg_NAMESPACE) - # NB: assume Qt Core is present. we're in an internal function, so it's - # a safe enough assumption - - # Apparently, -DQT_NAMESPACE only exists within qtbase or qt5's - # top-level build. Thus, in many other cases that option is unspecified. - # To avoid dealing with this, we can query the QT_NAMESPACE for QtCore's - # compile definitions (because we have it there). - get_target_property(arg_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE}::Core _qt_namespace) - endif() - - set(target_compile_qml_to_cpp_args "") - # Pass through options if given (these are present/absent, not true/false) - foreach(opt IN LISTS option_args) - if(arg_${opt}) - list(APPEND target_compile_qml_to_cpp_args ${opt}) - endif() - endforeach() - # Pass through single and multi-value args as provided. - foreach(arg IN LISTS single_args multi_args) - if(DEFINED arg_${arg}) - list(APPEND target_compile_qml_to_cpp_args ${arg} ${arg_${arg}}) - endif() - endforeach() - - qt6_target_compile_qml_to_cpp(${target} - ${target_compile_qml_to_cpp_args} - ) - -endfunction() |