diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-02-07 15:54:54 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-02-08 12:13:58 +0100 |
commit | 1f4b5760031bc0d2e090e0f76237a9477cebc65d (patch) | |
tree | 24e4b290ada4003bdc4831a40d02cc8c014812fd /tools | |
parent | d4d0530317d724db650e553fa7463601b601a4c0 (diff) |
CMake: Fix handling of empty qrc files with qtquickcompiler
Don't run rcc on empty qrc files. If the output of running rcc --list
at configure time was empty, than we shouldn't call qt5_add_resources
on the list of filetered rcc files because they will also be empty.
Revert the maOS ARM skipping of the test now that the underlying issue
is fixed.
As a drive-by, fix main.qml file size check in main.cpp. If the file
is successfully embedded, it shouldn't have a 0 size.
Amends eb1f9c2e687002643ebc80e51d4bfc5f0258da0d
Task-number: QTBUG-99362
Change-Id: I57dfaf1edbe5b26d051aed604703b2c7640dc4e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in index 26d42c02a9..8a91fb8b87 100644 --- a/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in +++ b/tools/qmlcachegen/Qt5QuickCompilerConfig.cmake.in @@ -40,6 +40,7 @@ but not all the files it references. set(rcc_files ${_RCC_UNPARSED_ARGUMENTS}) set(rcc_options ${_RCC_OPTIONS}) set(filtered_rcc_files) + set(output_resources) set(compiler_output) set(rcc_files_with_compilation_units) set(loader_flags) @@ -52,13 +53,15 @@ but not all the files it references. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${input_resource}") execute_process(COMMAND ${compiler_path} --filter-resource-file ${input_resource} -o ${new_resource_file} OUTPUT_VARIABLE remaining_files) - list(APPEND filtered_rcc_files ${new_resource_file}) - list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\") set(rcc_file_with_compilation_units) execute_process(COMMAND ${rcc_path} -list \"${input_resource}\" OUTPUT_VARIABLE rcc_contents) if (NOT rcc_contents STREQUAL \"\") + + list(APPEND filtered_rcc_files ${new_resource_file}) + list(APPEND loader_flags \"--resource-file-mapping=${_resource}=${new_resource_file}\") + string(REGEX REPLACE \"[\r\n]+\" \";\" rcc_contents ${rcc_contents}) foreach(it ${rcc_contents}) get_filename_component(extension ${it} EXT) @@ -85,6 +88,8 @@ but not all the files it references. list(APPEND compiler_output ${loader_source}) endif() - qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${rcc_options}) + if(filtered_rcc_files) + qt5_add_resources(output_resources ${filtered_rcc_files} OPTIONS ${rcc_options}) + endif() set(${outfiles} ${output_resources} ${compiler_output} PARENT_SCOPE) endfunction() |