Fix XCB feature detection

The xcb feature controls whether to build the xcb platform plugin. The
feature depends among other things on

    qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)

to succeed. This means at the moment setting XCB_FOUND to true, that's
what the condition checks.

Later on, in configure.cmake, we also check for other components in the
XCB package, for example:

    qt_find_package(XCB COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT)

If this component is not available, the xcb platform plugin has perhaps
reduce functionality, but it should be built and the feature should be
abled. However it isn't, because when that find_package call fails,
XCB_FOUND will be set to false. And that in turn will disable the
feature as the condition fails.

Therefore this patch changes the condition to check for the presence of
the XCB::XCB target instead.

Change-Id: I534087d8c3b7ff5edf81a5ffcf16cc0bb78b9fb7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-06-26 10:51:30 +02:00
parent a9d2c5b6d7
commit 8c60782124
2 changed files with 3 additions and 2 deletions

View File

@ -103,6 +103,7 @@ if((LINUX) OR QT_FIND_ALL_PACKAGES_ALWAYS)
qt_find_package(XRender PROVIDED_TARGETS PkgConfig::XRender)
endif()
#### Tests
# angle_d3d11_qdtd
@ -766,7 +767,7 @@ qt_feature("xcb" PRIVATE
SECTION "Platform plugins"
LABEL "XCB"
AUTODETECT NOT APPLE
CONDITION QT_FEATURE_thread AND QT_FEATURE_xkbcommon AND XCB_FOUND
CONDITION QT_FEATURE_thread AND QT_FEATURE_xkbcommon AND TARGET XCB::XCB
ENABLE INPUT_xcb STREQUAL 'system' OR INPUT_xcb STREQUAL 'qt' OR INPUT_xcb STREQUAL 'yes'
)
qt_feature("xcb_glx_plugin" PRIVATE

View File

@ -229,7 +229,7 @@ _library_map = [
LibraryMapping('vulkan', 'Vulkan', 'Vulkan::Vulkan'),
LibraryMapping('wayland_server', 'Wayland', 'Wayland::Server'),
LibraryMapping('x11sm', 'X11', '${X11_SM_LIB} ${X11_ICE_LIB}', resultVariable="X11_SM"),
LibraryMapping('xcb', 'XCB', 'XCB::XCB', extra = ['1.9']),
LibraryMapping('xcb', 'XCB', 'XCB::XCB', extra = ['1.9'], resultVariable='TARGET XCB::XCB', appendFoundSuffix=False),
LibraryMapping('xcb_glx', 'XCB', 'XCB::GLX', extra = ['COMPONENTS', 'GLX'], resultVariable='XCB_GLX'),
LibraryMapping('xcb_icccm', 'XCB', 'XCB::ICCCM', extra = ['COMPONENTS', 'ICCCM'], resultVariable='XCB_ICCCM'),
LibraryMapping('xcb_image', 'XCB', 'XCB::IMAGE', extra = ['COMPONENTS', 'IMAGE'], resultVariable='XCB_IMAGE'),