diff options
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 18 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/CMakeLists.txt | 41 |
2 files changed, 30 insertions, 29 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 331019849a..4c76c3e6ee 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -505,7 +505,7 @@ function(qt6_add_qml_module target) set(cache_target) qt6_target_qml_sources(${target} __QT_INTERNAL_FORCE_DEFER_QMLDIR - FILES ${arg_QML_FILES} + QML_FILES ${arg_QML_FILES} RESOURCES ${arg_RESOURCES} OUTPUT_TARGETS cache_target PREFIX "${qt_qml_module_resource_prefix}" @@ -1053,9 +1053,11 @@ endif() # # target: The backing target of the qml module. (REQUIRED) # -# FILES: The qml files to add to the backing target. Supported file extensions +# QML_FILES: The qml files to add to the backing target. Supported file extensions # are .qml, .js and .mjs. No other file types should be listed. (REQUIRED) # +# RESOURCES: Resources used in QML, for example images. (OPTIONAL) +# # PREFIX: The resource path under which to add the compiled qml files. If not # specified, the QT_RESOURCE_PREFIX property of the target is used (that # property is normally set by qt6_add_qml_module()). If the default is empty, @@ -1109,7 +1111,7 @@ endif() # QT_QML_SOURCE_TYPENAME MyQmlFile # # qt6_target_qml_sources(my_qml_module -# FILES +# QML_FILES # my_qml_file.qml # ) # @@ -1132,7 +1134,7 @@ function(qt6_target_qml_sources target) ) set(args_multi - FILES + QML_FILES RESOURCES ) @@ -1143,7 +1145,7 @@ function(qt6_target_qml_sources target) message(FATAL_ERROR "Unknown/unexpected arguments: ${arg_UNPARSED_ARGUMENTS}") endif() - if (NOT arg_FILES) + if (NOT arg_QML_FILES) if(arg_OUTPUT_TARGETS) set(${arg_OUTPUT_TARGETS} "" PARENT_SCOPE) endif() @@ -1241,7 +1243,7 @@ function(qt6_target_qml_sources target) set(non_qml_files) set(output_targets) - foreach(file_src IN LISTS arg_FILES arg_RESOURCES) + foreach(file_src IN LISTS arg_QML_FILES arg_RESOURCES) # We need to copy the file to the build directory now so that when # qmlimportscanner is run in qt6_import_qml_plugins() as part of # target finalizers, the files will be there. We need to do this @@ -1275,7 +1277,7 @@ function(qt6_target_qml_sources target) endif() endforeach() - foreach(qml_file_src IN LISTS arg_FILES) + foreach(qml_file_src IN LISTS arg_QML_FILES) # This is to facilitate updating code that used the earlier tech preview # API function qt6_target_qml_files() if(NOT qml_file_src MATCHES "\\.(js|mjs|qml)$") @@ -1426,7 +1428,7 @@ function(qt6_target_qml_sources target) set(resource_targets) qt6_add_resources(${target} ${resource_name} PREFIX ${arg_PREFIX} - FILES ${arg_FILES} ${arg_RESOURCES} + FILES ${arg_QML_FILES} ${arg_RESOURCES} OUTPUT_TARGETS resource_targets ) math(EXPR counter "${counter} + 1") diff --git a/tests/auto/qml/qmlcachegen/CMakeLists.txt b/tests/auto/qml/qmlcachegen/CMakeLists.txt index 4ef6aa8ce1..3848e79971 100644 --- a/tests/auto/qml/qmlcachegen/CMakeLists.txt +++ b/tests/auto/qml/qmlcachegen/CMakeLists.txt @@ -30,8 +30,7 @@ qt6_add_qml_module(tst_qmlcachegen NO_GENERATE_PLUGIN_SOURCE ) -# Resources: -set(qmake_workerscripts_test_resource_files +set(qmake_workerscripts_test_qml_files "data/worker.js" "data/worker.qml" ) @@ -39,8 +38,8 @@ set(qmake_workerscripts_test_resource_files qt6_target_qml_sources(tst_qmlcachegen PREFIX "/workerscripts" - FILES - ${qmake_workerscripts_test_resource_files} + QML_FILES + ${qmake_workerscripts_test_qml_files} ) set_source_files_properties("data/trickypaths.qml" PROPERTIES QT_RESOURCE_ALIAS "file name with spaces.qml" @@ -51,7 +50,7 @@ set_source_files_properties("data/versionStyleSuffix-1.2-core-yc.qml" set_source_files_properties("data/versionStyleSuffix-1.2-more.qml" PROPERTIES QT_RESOURCE_ALIAS "versionStyleSuffix-1.2-more.qml" ) -set(trickypaths_resource_files +set(trickypaths_qml_files "data/trickypaths.qml" "data/versionStyleSuffix-1.2-core-yc.qml" "data/versionStyleSuffix-1.2-more.qml" @@ -60,39 +59,39 @@ set(trickypaths_resource_files qt6_target_qml_sources(tst_qmlcachegen PREFIX "/directory with spaces" - FILES - ${trickypaths_resource_files} + QML_FILES + ${trickypaths_qml_files} ) set_source_files_properties("data/Retain.qml" PROPERTIES QT_RESOURCE_ALIAS "Retain.qml" ) -set(retain_resource_files +set(retain_qml_files "data/Retain.qml" ) qt6_target_qml_sources(tst_qmlcachegen PREFIX "/" - FILES - ${retain_resource_files} + QML_FILES + ${retain_qml_files} ) set_source_files_properties("data/SkipQmlCacheGen.qml" PROPERTIES QT_RESOURCE_ALIAS "Skip.qml" QT_QML_SKIP_CACHEGEN 1 ) -set(skip_resource_files +set(skip_qml_files "data/SkipQmlCacheGen.qml" ) qt6_target_qml_sources(tst_qmlcachegen PREFIX "/not/" - FILES - ${skip_resource_files} + QML_FILES + ${skip_qml_files} ) -set(qmake_immediate_resource_files +set(qmake_immediate_qml_files "data/Enums.qml" "data/componentInItem.qml" "data/jsimport.qml" @@ -109,8 +108,8 @@ set(qmake_immediate_resource_files qt6_target_qml_sources(tst_qmlcachegen PREFIX "/" - FILES - ${qmake_immediate_resource_files} + QML_FILES + ${qmake_immediate_qml_files} ) @@ -122,29 +121,29 @@ if(UNIX) set_source_files_properties("data/umlaut.qml" PROPERTIES QT_RESOURCE_ALIAS "Bäh.qml" ) - set(trickypaths_umlaut_resource_files + set(trickypaths_umlaut_qml_files "data/umlaut.qml" ) qt6_target_qml_sources(tst_qmlcachegen PREFIX "/" - FILES - ${trickypaths_umlaut_resource_files} + QML_FILES + ${trickypaths_umlaut_qml_files} ) endif() # Add those files to the resource system so that they get copied to the data # directory in the build directory, which is preferred by qFindTestData # over the one in the source directory where they are always placed. -set(qml_additional_resources +set(qml_additional_qml_files "data/posthocrequired.qml" "data/inlineComponentWithId.qml" ) qt6_target_qml_sources(tst_qmlcachegen PREFIX "/" - FILES ${qml_additional_resources} + QML_FILES ${qml_additional_qml_files} ) qt_internal_extend_target(tst_qmlcachegen CONDITION ANDROID OR IOS |