diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-16 10:42:48 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-03-16 14:04:10 +0100 |
commit | d3a35b062ee8587d5c8caf3c5a3d4d54dd2a651f (patch) | |
tree | f33e7a6f154b5b4f81d8bd045f6ff33a9536b730 /src | |
parent | 42cd696f8da13ce038b1572e7caaf77c60f3095f (diff) |
CMake: Fix version handling in qt6_qml_type_registration
We passed full version strings like "6.0.0" and the old
code passed "0.0" as the minor version, which is wrong.
Split the string on the dot character, and extract the
first and second parts to pass them along.
Change-Id: I5faf89176dfd51d5048ed9234fd84b25c8b48bea
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/Qt6QmlMacros.cmake | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 869b8c507b..3b38662b44 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -465,10 +465,18 @@ function(qt6_qml_type_registration target) if (NOT import_version MATCHES "[0-9]+\\.[0-9]+") message(FATAL_ERROR "Invalid module dependency version number. Expected VersionMajor.VersionMinor.") endif() - string(FIND "${import_version}" "." dot_location) - string(SUBSTRING ${import_version} 0 ${dot_location} major_version) - math(EXPR dot_location "${dot_location}+1") - string(SUBSTRING ${import_version} ${dot_location} -1 minor_version) + #string(FIND "${import_version}" "." dot_location) + #string(SUBSTRING ${import_version} 0 ${dot_location} major_version) + #math(EXPR dot_location "${dot_location}+1") + #string(SUBSTRING ${import_version} ${dot_location} -1 minor_version) + string(REPLACE "." ";" import_version_split "${import_version}") + list(LENGTH import_version_split import_version_split_length) + if(import_version_split_length GREATER 0) + list(GET import_version_split 0 major_version) + endif() + if(import_version_split_length GREATER 1) + list(GET import_version_split 1 minor_version) + endif() # check if plugins.qmltypes is already defined get_target_property(target_plugin_qmltypes ${target} QT_QML_MODULE_PLUGIN_TYPES_FILE) |