diff options
| -rw-r--r-- | modules/ECMQmlModule.cmake | 25 | 
1 files changed, 17 insertions, 8 deletions
| diff --git a/modules/ECMQmlModule.cmake b/modules/ECMQmlModule.cmake index 2e5147ae..aaff5dde 100644 --- a/modules/ECMQmlModule.cmake +++ b/modules/ECMQmlModule.cmake @@ -135,6 +135,19 @@ macro(_ecm_qmlmodule_verify_qml_target ARG_TARGET)      endif()  endmacro() +macro(_ecm_qmlmodule_uri_to_path ARG_OUTPUT ARG_PATH ARG_VERSION) +    string(REPLACE "." "/" _output "${ARG_PATH}") + +    # If the major version of the module is >2.0, Qt expects a ".MajorVersion" +    # suffix on the directory. So handle that. +    if (${ARG_VERSION} VERSION_GREATER_EQUAL 2.0) +        string(REGEX MATCH "^([0-9]+)" _version_major ${ARG_VERSION}) +        set("${ARG_OUTPUT}" "${_output}.${_version_major}") +    else() +        set("${ARG_OUTPUT}" "${_output}") +    endif() +endmacro() +  function(_ecm_qmlmodule_generate_qmldir ARG_TARGET)      get_target_property(_qml_uri ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_URI})      get_target_property(_qml_files ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_FILES}) @@ -182,12 +195,13 @@ function(_ecm_qmlmodule_generate_qrc ARG_TARGET)      get_target_property(_qml_uri ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_URI})      get_target_property(_qml_files ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_FILES})      get_target_property(_qmldir_file ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_QMLDIR}) +    get_target_property(_qml_version ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_VERSION}) -    string(REPLACE "." "/" _qml_prefix ${_qml_uri}) +    _ecm_qmlmodule_uri_to_path(_qml_prefix "${_qml_uri}" "${_qml_version}")      set(_qrc_template "<!-- This file was automatically generated by ECMQmlModule and should not be modified -->") -    string(APPEND _qrc_template "\n<RCC>\n<qresource prefix=\"${_qml_prefix}\">") +    string(APPEND _qrc_template "\n<RCC>\n<qresource prefix=\"/${_qml_prefix}\">")      string(APPEND _qrc_template "\n<file alias=\"qmldir\">${_qmldir_file}</file>")      foreach(_file ${_qml_files}) @@ -325,12 +339,7 @@ function(ecm_finalize_qml_module ARG_TARGET)      get_target_property(_qml_uri ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_URI})      get_target_property(_version ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_VERSION}) -    string(REPLACE "." "/" _plugin_path "${_qml_uri}") - -    if (${_version} VERSION_GREATER_EQUAL 2.0) -        string(REGEX MATCH "^([0-9]+)" _version_major ${_version}) -        set(_plugin_path "${_plugin_path}.${_version_major}") -    endif() +    _ecm_qmlmodule_uri_to_path(_plugin_path "${_qml_uri}" "${_version}")      get_target_property(_qml_only ${ARG_TARGET} ${_ECM_QMLMODULE_PROPERTY_QMLONLY}) | 
