summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-10 11:37:55 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-10 13:46:24 +0200
commita6eb7c641b3c6dbd0d5eeda3dbef54211ce95930 (patch)
treee2a05eed9de1ef8e3854c7ea5cf9c5e83fc3a7a9 /cmake
parent56f40cdca6b589beec5c2cb803633985ca4c59d1 (diff)
CMake: Fix dbus duplicate target errors in top-level builds
Fixes the 'add_library cannot create imported target "dbus-1" because another target with the same name already exists' error when doing top-level static builds. It's caused by the loading of Qt6DBus dependency when configuring qttools. Task-number: QTBUG-84874 Change-Id: Ia84ed460c4ce25de45fb41cb13edd0e63a276f11 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindWrapDBus1.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/FindWrapDBus1.cmake b/cmake/FindWrapDBus1.cmake
index 55f9757c45..7784c1a027 100644
--- a/cmake/FindWrapDBus1.cmake
+++ b/cmake/FindWrapDBus1.cmake
@@ -2,7 +2,10 @@
# Work around that:-/
# See https://gitlab.freedesktop.org/dbus/dbus/issues/267 for more information
-if(DBus1_FOUND OR WrapDBus1_FOUND)
+# When doing top-level static Qt builds, we need to protect against double creation of the dbus
+# target.
+if(DBus1_FOUND OR WrapDBus1_FOUND OR TARGET dbus-1)
+ set(WrapDBus1_FOUND 1)
return()
endif()