diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-04-03 10:04:04 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-04-03 21:51:10 +0200 |
commit | 1a2ab822fa24733f83d6720d2af8498ecbd5cbda (patch) | |
tree | fcbd1a25d6abd9e69059f04f96581ed6e01a80d5 | |
parent | bbf5777dc2688fd1f7ef87d8302b5a77c301472d (diff) |
CMake: Fix double inclusion of CMake plugin targets
After 99ace38d22c640e37bb1a41095ee3b126169816a, all plugin files are
included automatically, not only the ones ending in Plugin.cmake.
Thus the extra inclusion done by the QmlConfigExtras file should only
be done if strict mode is set.
This fixes errors of the following type when doing find_package(Qt5Qml)
add_library cannot create imported target
"Qt5::QTcpServerConnectionFactory" because another target with the same
name already exists.
Amends 99ace38d22c640e37bb1a41095ee3b126169816a
Amends 2f2dd3b0c28db210ea1f00d569f6c1626894c5f4
Task-number: QTBUG-83282
Change-Id: I205036092bff9925aa95472f0aa6a212f0372227
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/qml/Qt5QmlConfigExtras.cmake.in | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/Qt5QmlConfigExtras.cmake.in b/src/qml/Qt5QmlConfigExtras.cmake.in index 9ddb9885cd..4242143bca 100644 --- a/src/qml/Qt5QmlConfigExtras.cmake.in +++ b/src/qml/Qt5QmlConfigExtras.cmake.in @@ -1,5 +1,7 @@ -file(GLOB _qt5qml_other_plugins "${CMAKE_CURRENT_LIST_DIR}/Qt5Qml_*Factory.cmake") +if(QT5_STRICT_PLUGIN_GLOB OR Qt5Qml_STRICT_PLUGIN_GLOB) + file(GLOB _qt5qml_other_plugins "${CMAKE_CURRENT_LIST_DIR}/Qt5Qml_*Factory.cmake") -foreach(_other_plugin ${_qt5qml_other_plugins}) - include(${_other_plugin} OPTIONAL) -endforeach() + foreach(_other_plugin ${_qt5qml_other_plugins}) + include(${_other_plugin} OPTIONAL) + endforeach() +endif() |