Skip to content

Commit

Permalink
ECMQmlModule6: group qml and resource file calls
Browse files Browse the repository at this point in the history
Otherwise we get a different qrc file for each occurrence ending up with
an overly complex call for no reason.
  • Loading branch information
aleixpol committed Apr 9, 2024
1 parent eff69a1 commit eeac86c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/ECMQmlModule6.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ function(ecm_target_qml_sources ARG_TARGET)
set_source_files_properties(${ARG_SOURCES} PROPERTIES QT_QML_INTERNAL_TYPE TRUE)
endif()

set(_QML_FILES)
set(_RESOURCES)
foreach(_path ${ARG_SOURCES})
get_filename_component(_file "${_path}" NAME)
get_filename_component(_ext "${_path}" EXT)
Expand All @@ -121,11 +123,19 @@ function(ecm_target_qml_sources ARG_TARGET)
endif()
set_source_files_properties("${_path}" PROPERTIES QT_RESOURCE_ALIAS "${_resource_alias}")
if ("${_ext}" MATCHES "(.qml|.js|.mjs)")
qt6_target_qml_sources(${ARG_TARGET} QML_FILES "${_path}" ${ARG_UNPARSED_ARGUMENTS})
list(APPEND _QML_FILES "${_path}")
else()
qt6_target_qml_sources(${ARG_TARGET} RESOURCES "${_path}" ${ARG_UNPARSED_ARGUMENTS})
list(APPEND _RESOURCES "${_path}")
endif()
endforeach()

if(_QML_FILES)
qt6_target_qml_sources(${ARG_TARGET} QML_FILES ${_QML_FILES} ${ARG_UNPARSED_ARGUMENTS})
endif()
if(_RESOURCES)
qt6_target_qml_sources(${ARG_TARGET} RESOURCES ${_RESOURCES} ${ARG_UNPARSED_ARGUMENTS})
endif()

endfunction()

function(ecm_finalize_qml_module ARG_TARGET)
Expand Down

0 comments on commit eeac86c

Please sign in to comment.