From 1a2ab822fa24733f83d6720d2af8498ecbd5cbda Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 3 Apr 2020 10:04:04 +0200 Subject: 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 Reviewed-by: Friedemann Kleint --- src/qml/Qt5QmlConfigExtras.cmake.in | 10 ++++++---- 1 file 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() -- cgit v1.2.3