From a6eb7c641b3c6dbd0d5eeda3dbef54211ce95930 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 10 Jun 2020 11:37:55 +0200 Subject: 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 --- cmake/FindWrapDBus1.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3