a6eb7c641b
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>
43 lines
1.0 KiB
CMake
43 lines
1.0 KiB
CMake
# DBus1 is buggy and breaks PKG_CONFIG environment.
|
|
# Work around that:-/
|
|
# See https://gitlab.freedesktop.org/dbus/dbus/issues/267 for more information
|
|
|
|
# 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()
|
|
|
|
if(DEFINED ENV{PKG_CONFIG_DIR})
|
|
set(__qt_dbus_pcd "$ENV{PKG_CONFIG_DIR}")
|
|
endif()
|
|
if(DEFINED ENV{PKG_CONFIG_PATH})
|
|
set(__qt_dbus_pcp "$ENV{PKG_CONFIG_PATH}")
|
|
endif()
|
|
if(DEFINED ENV{PKG_CONFIG_LIBDIR})
|
|
set(__qt_dbus_pcl "$ENV{PKG_CONFIG_LIBDIR}")
|
|
endif()
|
|
|
|
find_package(DBus1)
|
|
|
|
if(DEFINED __qt_dbus_pcd)
|
|
set(ENV{PKG_CONFIG_DIR} "${__qt_dbus_pcd}")
|
|
else()
|
|
unset(ENV{PKG_CONFIG_DIR})
|
|
endif()
|
|
if(DEFINED __qt_dbus_pcp)
|
|
set(ENV{PKG_CONFIG_PATH} "${__qt_dbus_pcp}")
|
|
else()
|
|
unset(ENV{PKG_CONFIG_PATH})
|
|
endif()
|
|
if(DEFINED __qt_dbus_pcl)
|
|
set(ENV{PKG_CONFIG_LIBDIR} "${__qt_dbus_pcl}")
|
|
else()
|
|
unset(ENV{PKG_CONFIG_LIBDIR})
|
|
endif()
|
|
|
|
if(DBus1_FOUND)
|
|
set(WrapDBus1_FOUND 1)
|
|
endif()
|