Rework finding of XCB

Uses the new components syntax of FindXCB. So far plasma frameworks
only need the XCB component and that one is optional just like XLib.

The find xcb is moved to the toplevel CMakeLists.txt together with
the find x11 and HAVE_X11 gets set only if both X11 and XCB are found.

REVIEW: 112499
This commit is contained in:
Martin Gräßlin 2013-09-04 07:14:24 +02:00
parent 7cabdaa3d6
commit 97ce3dc808
3 changed files with 11 additions and 16 deletions

View File

@ -76,8 +76,13 @@ find_package(KDE4Support REQUIRED NO_MODULE)
#optional features
find_package(X11 MODULE)
if(X11_FOUND)
set(HAVE_X11 X11_FOUND)
find_package(XCB MODULE COMPONENTS XCB)
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
URL "http://xcb.freedesktop.org"
TYPE RECOMMENDED
)
if(X11_FOUND AND XCB_XCB_FOUND)
set(HAVE_X11 1)
#X11_Xrender discovery is done by FindX11
add_feature_info("X Rendering Extension (libXrender)" X11_Xrender_FOUND "Support for compositing, rendering operations, and alpha-blending. STRONGLY RECOMMENDED")
add_feature_info("X Screensaver Extension (libXss)" X11_Xscreensaver_FOUND "Support for KIdleTime (fallback mode)")

View File

@ -9,12 +9,7 @@ INCLUDE_DIRECTORIES(
${KDECLARATIVE_INCLUDE_DIR}
)
add_definitions(-DHAVE_X11=${X11_FOUND})
if(X11_FOUND)
# FIXME: remove when upstream CMakeLists is fixed
find_package(XCB REQUIRED)
endif()
add_definitions(-DHAVE_X11=${HAVE_X11})
set(corebindings_SRCS
corebindingsplugin.cpp
@ -46,7 +41,7 @@ target_link_libraries(corebindingsplugin
plasma)
if(X11_FOUND)
target_link_libraries(corebindingsplugin ${X11_LIBRARIES} ${XCB_XCB_LIBRARIES} )
target_link_libraries(corebindingsplugin ${X11_LIBRARIES} ${XCB_XCB_LIBRARY} )
target_link_libraries(corebindingsplugin Qt5::X11Extras)
endif(X11_FOUND)

View File

@ -14,12 +14,7 @@ find_path(KDE_MODULES_DIR NAMES KDE4Macros.cmake PATH_SUFFIXES share/cmake/modul
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DHAVE_X11=${X11_FOUND})
if(X11_FOUND)
# FIXME: remove when upstream CMakeLists is fixed
find_package(XCB REQUIRED)
endif()
add_definitions(-DHAVE_X11=${HAVE_X11})
find_package(Qt5Transitional REQUIRED Core)
find_package(Qt5Qml REQUIRED)
@ -98,7 +93,7 @@ target_link_libraries(plasma-shell
)
if(X11_FOUND)
target_link_libraries(plasma-shell ${X11_LIBRARIES} ${XCB_XCB_LIBRARIES} )
target_link_libraries(plasma-shell ${X11_LIBRARIES} ${XCB_XCB_LIBRARY} )
target_link_libraries(plasma-shell Qt5::X11Extras)
endif(X11_FOUND)