From 400f94109dfb0b8fc28ee1e852b59891d3084624 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 8 May 2019 14:33:58 +0200 Subject: [PATCH] CMake: Wrap DBus1 find_package call to fix xproto not being picked up DBus1 (1.12) configuration file breaks PKG_CONFIG environment variables and will thus prevent other libraries to be picked up by pkgconfig. Main sympthom is that xproto is not getting picked up anymore, which results in hundreds of lines of warnings about this being printed. Work around that by wrapping the call to find_package(DBus1) and restoring the environment. Change-Id: Ia69f10b014dddc32045b40972500a843e5d29b38 Reviewed-by: Alexandru Croitor --- cmake/FindWrapDBus1.cmake | 10 ++++++++++ configure.cmake | 2 +- util/cmake/helper.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 cmake/FindWrapDBus1.cmake diff --git a/cmake/FindWrapDBus1.cmake b/cmake/FindWrapDBus1.cmake new file mode 100644 index 00000000000..3e0a31592c4 --- /dev/null +++ b/cmake/FindWrapDBus1.cmake @@ -0,0 +1,10 @@ +# DBus1 is buggy and breaks PKG_CONFIG environment. +# Work around that:-/ + +set(__qt_dbus_pcd $ENV{PKG_CONFIG_DIR}) +set(__qt_dbus_pcp $ENV{PKG_CONFIG_PATH}) +set(__qt_dbus_pcl $ENV{PKG_CONFIG_LIBDIR}) +find_package(DBus1) +set(ENV{PKG_CONFIG_DIR} ${__qt_dbus_pcd}) +set(ENV{PKG_CONFIG_PATH} ${__qt_dbus_pcp}) +set(ENV{PKG_CONFIG_LIBDIR} ${__qt_dbus_pcl}) diff --git a/configure.cmake b/configure.cmake index 92e4198adde..957d7fb13b0 100644 --- a/configure.cmake +++ b/configure.cmake @@ -9,7 +9,7 @@ qt_find_package(ZLIB PROVIDED_TARGETS ZLIB::ZLIB) set_package_properties(ZLIB PROPERTIES TYPE REQUIRED) qt_find_package(ZSTD PROVIDED_TARGETS ZSTD::ZSTD) -qt_find_package(DBus1 PROVIDED_TARGETS dbus-1) +qt_find_package(WrapDBus1 PROVIDED_TARGETS dbus-1) qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev) diff --git a/util/cmake/helper.py b/util/cmake/helper.py index 0520e4fdb2b..99d9242eba9 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -177,7 +177,7 @@ _library_map = [ LibraryMapping('atspi', 'ATSPI2', 'PkgConfig::ATSPI2'), LibraryMapping('corewlan', None, None), LibraryMapping('cups', 'Cups', 'Cups::Cups'), - LibraryMapping('dbus', 'DBus1', 'dbus-1'), + LibraryMapping('dbus', 'WrapDBus1', 'dbus-1', resultVariable="DBus1"), LibraryMapping('doubleconversion', None, None), LibraryMapping('drm', 'Libdrm', 'Libdrm::Libdrm'), LibraryMapping('egl', 'EGL', 'EGL::EGL'),