Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/cmake/modules/FindXCB.cmake
- This file was added.
1 | # Try to find XCB on a Unix system | ||||
---|---|---|---|---|---|
2 | # | ||||
3 | # This will define: | ||||
4 | # | ||||
5 | # XCB_FOUND - True if xcb is available | ||||
6 | # XCB_LIBRARIES - Link these to use xcb | ||||
7 | # XCB_INCLUDE_DIR - Include directory for xcb | ||||
8 | # XCB_DEFINITIONS - Compiler flags for using xcb | ||||
9 | # | ||||
10 | # In addition the following more fine grained variables will be defined: | ||||
11 | # | ||||
12 | # XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES | ||||
13 | # XCB_RECORD_FOUND XCB_RECORD_INCLUDE_DIR XCB_RECORD_LIBRARIES | ||||
14 | # | ||||
15 | # Copyright (c) 2012 Fredrik Höglund <fredrik@kde.org> | ||||
16 | # | ||||
17 | # Redistribution and use in source and binary forms, with or without | ||||
18 | # modification, are permitted provided that the following conditions | ||||
19 | # are met: | ||||
20 | # 1. Redistributions of source code must retain the above copyright | ||||
21 | # notice, this list of conditions and the following disclaimer. | ||||
22 | # 2. Redistributions in binary form must reproduce the above copyright | ||||
23 | # notice, this list of conditions and the following disclaimer in the | ||||
24 | # documentation and/or other materials provided with the distribution. | ||||
25 | # 3. Neither the name of the University nor the names of its contributors | ||||
26 | # may be used to endorse or promote products derived from this software | ||||
27 | # without specific prior written permission. | ||||
28 | # | ||||
29 | # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||||
30 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||||
31 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||||
32 | # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||||
33 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
34 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
35 | # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
36 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
37 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
38 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
39 | # SUCH DAMAGE. | ||||
40 | | ||||
41 | | ||||
42 | IF (NOT WIN32) | ||||
43 | IF (XCB_INCLUDE_DIR AND XCB_LIBRARIES) | ||||
44 | # In the cache already | ||||
45 | SET(XCB_FIND_QUIETLY TRUE) | ||||
46 | ENDIF (XCB_INCLUDE_DIR AND XCB_LIBRARIES) | ||||
47 | | ||||
48 | # Use pkg-config to get the directories and then use these values | ||||
49 | # in the FIND_PATH() and FIND_LIBRARY() calls | ||||
50 | FIND_PACKAGE(PkgConfig) | ||||
51 | PKG_CHECK_MODULES(PKG_XCB QUIET xcb) | ||||
52 | | ||||
53 | SET(XCB_DEFINITIONS ${PKG_XCB_CFLAGS}) | ||||
54 | | ||||
55 | FIND_PATH(XCB_XCB_INCLUDE_DIR NAMES xcb/xcb.h HINTS ${PKG_XCB_INCLUDE_DIRS}) | ||||
56 | FIND_PATH(XCB_RECORD_INCLUDE_DIR NAMES xcb/record.h HINTS ${PKG_XCB_INCLUDE_DIRS}) | ||||
57 | | ||||
58 | FIND_LIBRARY(XCB_XCB_LIBRARIES NAMES xcb HINTS ${PKG_XCB_LIBRARY_DIRS}) | ||||
59 | FIND_LIBRARY(XCB_RECORD_LIBRARIES NAMES xcb-record HINTS ${PKG_XCB_LIBRARY_DIRS}) | ||||
60 | | ||||
61 | set(XCB_INCLUDE_DIR ${XCB_XCB_INCLUDE_DIR} ${XCB_RECORD_INCLUDE_DIR}) | ||||
62 | | ||||
63 | set(XCB_LIBRARIES ${XCB_XCB_LIBRARIES} ${XCB_RECORD_LIBRARIES}) | ||||
64 | | ||||
65 | list(REMOVE_DUPLICATES XCB_INCLUDE_DIR) | ||||
66 | | ||||
67 | include(FindPackageHandleStandardArgs) | ||||
68 | | ||||
69 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XCB DEFAULT_MSG XCB_XCB_LIBRARIES XCB_XCB_INCLUDE_DIR) | ||||
70 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RECORD DEFAULT_MSG XCB_RECORD_LIBRARIES XCB_RECORD_INCLUDE_DIR) | ||||
71 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIR) | ||||
72 | | ||||
73 | MARK_AS_ADVANCED( | ||||
74 | XCB_INCLUDE_DIR XCB_LIBRARIES | ||||
75 | XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES | ||||
76 | XCB_RECORD_INCLUDE_DIR XCB_RECORD_LIBRARIES | ||||
77 | ) | ||||
78 | | ||||
79 | ENDIF (NOT WIN32) | ||||
80 | |