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 <alexandru.croitor@qt.io>
This commit is contained in:
Tobias Hunger 2019-05-08 14:33:58 +02:00 committed by Albert Astals Cid
parent 263af45b4c
commit 400f94109d
3 changed files with 12 additions and 2 deletions

10
cmake/FindWrapDBus1.cmake Normal file
View File

@ -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})

View File

@ -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)

View File

@ -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'),