[extra-cmake-modules] find-modules: Add XCB find modules by Fredrik Höglund <fredrik at kde.org>
David Faure
faure at kde.org
Wed Oct 31 17:22:02 UTC 2012
Git commit e80c4de28ab31bd90875c792448aec671a288957 by David Faure.
Committed on 24/07/2012 at 20:42.
Pushed by dfaure into branch 'master'.
Add XCB find modules by Fredrik Höglund <fredrik at kde.org>
At least one bug: XCB_INCLUDE_DIR contains NOTFOUND if at least one
module is missing (e.g. UTIL and EWMH, here), which makes XCB_FOUND false.
Please review, and port to FIND_PACKAGE(XCB COMPONENTS ...)
CCMAIL: kde-buildsystem at kde.org
A +31 -0 find-modules/FindX11_XCB.cmake
A +150 -0 find-modules/FindXCB.cmake
http://commits.kde.org/extra-cmake-modules/e80c4de28ab31bd90875c792448aec671a288957
diff --git a/find-modules/FindX11_XCB.cmake b/find-modules/FindX11_XCB.cmake
new file mode 100644
index 0000000..e2c18a9
--- /dev/null
+++ b/find-modules/FindX11_XCB.cmake
@@ -0,0 +1,31 @@
+# - Try to find libX11-xcb
+# Once done this will define
+#
+# X11_XCB_FOUND - system has libX11-xcb
+# X11_XCB_LIBRARIES - Link these to use libX11-xcb
+# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
+# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
+
+# Copyright (c) 2011 Fredrik Höglund <fredrik at kde.org>
+# Copyright (c) 2008 Helio Chissini de Castro, <helio at kde.org>
+# Copyright (c) 2007 Matthias Kretz, <kretz at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+IF (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ FIND_PACKAGE(PkgConfig)
+ PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
+
+ SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
+
+ FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
+ FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
+
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
+
+ MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
+ENDIF (NOT WIN32)
diff --git a/find-modules/FindXCB.cmake b/find-modules/FindXCB.cmake
new file mode 100644
index 0000000..7def4eb
--- /dev/null
+++ b/find-modules/FindXCB.cmake
@@ -0,0 +1,150 @@
+# Try to find XCB on a Unix system
+#
+# This will define:
+#
+# XCB_FOUND - True if xcb is available
+# XCB_LIBRARIES - Link these to use xcb
+# XCB_INCLUDE_DIR - Include directory for xcb
+# XCB_DEFINITIONS - Compiler flags for using xcb
+#
+# In addition the following more fine grained variables will be defined:
+#
+# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES
+# XCB_UTIL_FOUND XCB_UTIL_INCLUDE_DIR XCB_UTIL_LIBRARIES
+# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARIES
+# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARIES
+# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARIES
+# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARIES
+# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARIES
+# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARIES
+# XCB_DRI2_FOUND XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARIES
+# XCB_GLX_FOUND XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARIES
+# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARIES
+# XCB_XV_FOUND XCB_XV_INCLUDE_DIR XCB_XV_LIBRARIES
+# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARIES
+# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARIES
+# XCB_ICCCM_FOUND XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARIES
+# XCB_EWMH_FOUND XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARIES
+# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARIES
+# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARIES
+#
+# Copyright (c) 2011 Fredrik Höglund <fredrik at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (NOT WIN32)
+ IF (XCB_INCLUDE_DIR AND XCB_LIBRARIES)
+ # In the cache already
+ SET(XCB_FIND_QUIETLY TRUE)
+ ENDIF (XCB_INCLUDE_DIR AND XCB_LIBRARIES)
+
+ # Use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ FIND_PACKAGE(PkgConfig)
+ PKG_CHECK_MODULES(PKG_XCB QUIET xcb xcb-util xcb-composite xcb-xfixes xcb-damage xcb-render xcb-randr
+ xcb-shape xcb-dri2 xcb-glx xcb-shm xcb-xv xcb-sync
+ xcb-xtest xcb-icccm xcb-ewmh xcb-image xcb-renderutil)
+
+ SET(XCB_DEFINITIONS ${PKG_XCB_CFLAGS})
+
+ FIND_PATH(XCB_XCB_INCLUDE_DIR NAMES xcb/xcb.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_UTIL_INCLUDE_DIR NAMES xcb/xcb_util.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_COMPOSITE_INCLUDE_DIR NAMES xcb/composite.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_XFIXES_INCLUDE_DIR NAMES xcb/xfixes.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_DAMAGE_INCLUDE_DIR NAMES xcb/damage.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_RENDER_INCLUDE_DIR NAMES xcb/render.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_RANDR_INCLUDE_DIR NAMES xcb/randr.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_SHAPE_INCLUDE_DIR NAMES xcb/shape.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_DRI2_INCLUDE_DIR NAMES xcb/dri2.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_GLX_INCLUDE_DIR NAMES xcb/glx.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_SHM_INCLUDE_DIR NAMES xcb/shm.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_XV_INCLUDE_DIR NAMES xcb/xv.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_SYNC_INCLUDE_DIR NAMES xcb/sync.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_XTEST_INCLUDE_DIR NAMES xcb/xtest.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_ICCCM_INCLUDE_DIR NAMES xcb/xcb_icccm.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_EWMH_INCLUDE_DIR NAMES xcb/xcb_ewmh.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_IMAGE_INCLUDE_DIR NAMES xcb/xcb_image.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+ FIND_PATH(XCB_RENDERUTIL_INCLUDE_DIR NAMES xcb/xcb_renderutil.h HINTS ${PKG_XCB_INCLUDE_DIRS})
+
+ FIND_LIBRARY(XCB_XCB_LIBRARIES NAMES xcb HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_UTIL_LIBRARIES NAMES xcb-util HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_COMPOSITE_LIBRARIES NAMES xcb-composite HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_DAMAGE_LIBRARIES NAMES xcb-damage HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_XFIXES_LIBRARIES NAMES xcb-xfixes HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_RENDER_LIBRARIES NAMES xcb-render HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_RANDR_LIBRARIES NAMES xcb-randr HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_SHAPE_LIBRARIES NAMES xcb-shape HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_DRI2_LIBRARIES NAMES xcb-dri2 HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_GLX_LIBRARIES NAMES xcb-glx HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_SHM_LIBRARIES NAMES xcb-shm HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_XV_LIBRARIES NAMES xcb-xv HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_SYNC_LIBRARIES NAMES xcb-sync HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_XTEST_LIBRARIES NAMES xcb-xtest HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_ICCCM_LIBRARIES NAMES xcb-icccm HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_EWMH_LIBRARIES NAMES xcb-ewmh HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_IMAGE_LIBRARIES NAMES xcb-image HINTS ${PKG_XCB_LIBRARY_DIRS})
+ FIND_LIBRARY(XCB_RENDERUTIL_LIBRARIES NAMES xcb-render-util HINTS ${PKG_XCB_LIBRARY_DIRS})
+
+ set(XCB_INCLUDE_DIR ${XCB_XCB_INCLUDE_DIR} ${XCB_UTIL_INCLUDE_DIR} ${XCB_COMPOSITE_INCLUDE_DIR}
+ ${XCB_XFIXES_INCLUDE_DIR} ${XCB_DAMAGE_INCLUDE_DIR} ${XCB_RENDER_INCLUDE_DIR}
+ ${XCB_RANDR_INCLUDE_DIR} ${XCB_SHAPE_INCLUDE_DIR} ${XCB_DRI2_INCLUDE_DIR}
+ ${XCB_GLX_INCLUDE_DIR} ${XCB_SHM_INCLUDE_DIR} ${XCB_XV_INCLUDE_DIR}
+ ${XCB_SYNC_INCLUDE_DIR} ${XCB_XTEST_INCLUDE_DIR} ${XCB_ICCCM_INCLUDE_DIR}
+ ${XCB_EWMH_INCLUDE_DIR} ${XCB_IMAGE_INCLUDE_DIR} ${XCB_RENDERUTIL_INCLUDE_DIR})
+
+ set(XCB_LIBRARIES ${XCB_XCB_LIBRARIES} ${XCB_UTIL_LIBRARIES} ${XCB_COMPOSITE_LIBRARIES}
+ ${XCB_XFIXES_LIBRARIES} ${XCB_DAMAGE_LIBRARIES} ${XCB_RENDER_LIBRARIES}
+ ${XCB_RANDR_LIBRARIES} ${XCB_SHAPE_LIBRARIES} ${XCB_DRI2_LIBRARIES} ${XCB_GLX_LIBRARIES}
+ ${XCB_SHM_LIBRARIES} ${XCB_XV_LIBRARIES} ${XCB_SYNC_LIBRARIES} ${XCB_XTEST_LIBRARIES}
+ ${XCB_ICCCM_LIBRARIES} ${XCB_EWMH_LIBRARIES} ${XCB_IMAGE_LIBRARIES}
+ ${XCB_RENDERUTIL_LIBRARIES})
+
+ list(REMOVE_DUPLICATES XCB_INCLUDE_DIR)
+
+ include(FindPackageHandleStandardArgs)
+
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XCB DEFAULT_MSG XCB_XCB_LIBRARIES XCB_XCB_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_UTIL DEFAULT_MSG XCB_UTIL_LIBRARIES XCB_UTIL_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_COMPOSITE DEFAULT_MSG XCB_COMPOSITE_LIBRARIES XCB_COMPOSITE_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_DAMAGE DEFAULT_MSG XCB_DAMAGE_LIBRARIES XCB_DAMAGE_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XFIXES DEFAULT_MSG XCB_XFIXES_LIBRARIES XCB_XFIXES_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RENDER DEFAULT_MSG XCB_RENDER_LIBRARIES XCB_RENDER_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RANDR DEFAULT_MSG XCB_RANDR_LIBRARIES XCB_RANDR_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SHAPE DEFAULT_MSG XCB_SHAPE_LIBRARIES XCB_SHAPE_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_DRI2 DEFAULT_MSG XCB_DRI2_LIBRARIES XCB_DRI2_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_GLX DEFAULT_MSG XCB_GLX_LIBRARIES XCB_GLX_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SHM DEFAULT_MSG XCB_SHM_LIBRARIES XCB_SHM_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XV DEFAULT_MSG XCB_XV_LIBRARIES XCB_XV_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SYNC DEFAULT_MSG XCB_SYNC_LIBRARIES XCB_SYNC_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XTEST DEFAULT_MSG XCB_XTEST_LIBRARIES XCB_XTEST_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_ICCCM DEFAULT_MSG XCB_ICCCM_LIBRARIES XCB_ICCCM_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_EWMH DEFAULT_MSG XCB_EWMH_LIBRARIES XCB_EWMH_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_IMAGE DEFAULT_MSG XCB_IMAGE_LIBRARIES XCB_IMAGE_INCLUDE_DIR)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RENDERUTIL DEFAULT_MSG XCB_RENDERUTIL_LIBRARIES XCB_RENDERUTIL_INCLUDE_DIR)
+
+ MARK_AS_ADVANCED(
+ XCB_INCLUDE_DIR XCB_LIBRARIES
+ XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES
+ XCB_UILT_INCLUDE_DIR XCB_UTIL_LIBRARIES
+ XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARIES
+ XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARIES
+ XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARIES
+ XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARIES
+ XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARIES
+ XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARIES
+ XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARIES
+ XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARIES
+ XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARIES
+ XCB_XV_INCLUDE_DIR XCB_XV_LIBRARIES
+ XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARIES
+ XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARIES
+ XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARIES
+ XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARIES
+ XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARIES
+ XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARIES
+ )
+
+ENDIF (NOT WIN32)
More information about the Kde-buildsystem
mailing list