diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-27 12:32:20 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-06 13:00:54 +0100 |
commit | cd513c3e1767c7ca3626d4150609fd704c02e4f1 (patch) | |
tree | 2431c89352a499537dee6a304899b78527be284c /src/qml/Qt6QmlMacros.cmake | |
parent | 4a9e5c5e89e403b492f08c5a4a1f5334a8b21ad3 (diff) |
CMake: Clean up logic to prepare building pure QML modules
Make sure we don't create bogus typeinfo entries, do create a target if
there are no C++ files, and do install created targets.
This way we do build the qmlcachegen-created files and link them into a
library which is subsequently deployed. It's not a real plugin, though,
and we need to specially handle this in QML. That's material for a
separate change.
Change-Id: I516d4611b6041a23489ce57df38dd83114dcc5de
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index b4acf4076d..c6b11d5ba1 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -225,13 +225,20 @@ function(qt6_add_qml_module target) QT_QML_MODULE_RESOURCE_EXPORT "${arg_RESOURCE_EXPORT}" ) - if (arg_OUTPUT_DIRECTORY AND NOT DO_NOT_CREATE_TARGET) - set_target_properties(${target} - PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" - ARCHIVE_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" - ) + if (NOT DO_NOT_CREATE_TARGET) + if (arg_OUTPUT_DIRECTORY) + set_target_properties(${target} + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" + ARCHIVE_OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" + ) + elseif (should_install) + install(TARGETS ${target} + DESTINATION "${arg_INSTALL_LOCATION}" + ) + endif() endif() + if (arg_OUTPUT_DIRECTORY) set(target_output_dir ${arg_OUTPUT_DIRECTORY}) else() @@ -281,13 +288,15 @@ function(qt6_add_qml_module target) endif() if (arg_TYPEINFO) string(APPEND qmldir_file_contents "typeinfo ${arg_TYPEINFO}\n") - else() + elseif (arg_SOURCES) # This always need to be written out since at the moment we have cases # where qmltyperegistrar is not run with the plugin but on a module # e.g: src/qml generates the qmltypes for src/imports/qtqml. # When this has been fixed/standardized we should move this to # qt6_qml_type_registration() so that it is written out when the # plugins.qmltypes is actually generated. + # However, if there are no sources, then this is a pure QML module. In + # that case there cannot be a plugins.qmltypes file. string(APPEND qmldir_file_contents "typeinfo plugins.qmltypes\n") endif() |