Debian Codegraph @

cmake/3rdparty/extra-cmake-modules/find-modules/FindXCB.cmake

raw
1 #.rst:
2 # FindXCB
3 # -------
4 #
5 # Try to find XCB.
6 #
7 # This is a component-based find module, which makes use of the COMPONENTS and
8 # OPTIONAL_COMPONENTS arguments to find_module. The following components are
9 # available::
10 #
11 # XCB
12 # ATOM AUX COMPOSITE CURSOR DAMAGE
13 # DPMS DRI2 DRI3 EVENT EWMH
14 # GLX ICCCM IMAGE KEYSYMS PRESENT
15 # RANDR RECORD RENDER RENDERUTIL RES
16 # SCREENSAVER SHAPE SHM SYNC UTIL
17 # XEVIE XF86DRI XFIXES XINERAMA XINPUT
18 # XKB XPRINT XTEST XV XVMC
19 #
20 # If no components are specified, this module will act as though all components
21 # except XINPUT (which is considered unstable) were passed to
22 # OPTIONAL_COMPONENTS.
23 #
24 # This module will define the following variables, independently of the
25 # components searched for or found:
26 #
27 # ``XCB_FOUND``
28 # True if (the requestion version of) xcb is available
29 # ``XCB_VERSION``
30 # Found xcb version
31 # ``XCB_TARGETS``
32 # A list of all targets imported by this module (note that there may be more
33 # than the components that were requested)
34 # ``XCB_LIBRARIES``
35 # This can be passed to target_link_libraries() instead of the imported
36 # targets
37 # ``XCB_INCLUDE_DIRS``
38 # This should be passed to target_include_directories() if the targets are
39 # not used for linking
40 # ``XCB_DEFINITIONS``
41 # This should be passed to target_compile_options() if the targets are not
42 # used for linking
43 #
44 # For each searched-for components, ``XCB_<component>_FOUND`` will be set to
45 # true if the corresponding xcb library was found, and false otherwise. If
46 # ``XCB_<component>_FOUND`` is true, the imported target ``XCB::<component>``
47 # will be defined. This module will also attempt to determine
48 # ``XCB_*_VERSION`` variables for each imported target, although
49 # ``XCB_VERSION`` should normally be sufficient.
50 #
51 # In general we recommend using the imported targets, as they are easier to use
52 # and provide more control. Bear in mind, however, that if any target is in the
53 # link interface of an exported library, it must be made available by the
54 # package config file.
55 #
56 # Since pre-1.0.0.
57
58 #=============================================================================
59 # Copyright 2011 Fredrik Höglund <[email protected]>
60 # Copyright 2013 Martin Gräßlin <[email protected]>
61 # Copyright 2014-2015 Alex Merry <[email protected]>
62 #
63 # Redistribution and use in source and binary forms, with or without
64 # modification, are permitted provided that the following conditions
65 # are met:
66 #
67 # 1. Redistributions of source code must retain the copyright
68 # notice, this list of conditions and the following disclaimer.
69 # 2. Redistributions in binary form must reproduce the copyright
70 # notice, this list of conditions and the following disclaimer in the
71 # documentation and/or other materials provided with the distribution.
72 # 3. The name of the author may not be used to endorse or promote products
73 # derived from this software without specific prior written permission.
74 #
75 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
76 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
77 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
78 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
79 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
80 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
81 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
84 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85 #=============================================================================
86
87 include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)
88
89 ecm_find_package_version_check(XCB)
90
91 # Note that this list needs to be ordered such that any component
92 # appears after its dependencies
93 set(XCB_known_components
94 XCB
95 RENDER
96 SHAPE
97 XFIXES
98 SHM
99 ATOM
100 AUX
101 COMPOSITE
102 CURSOR
103 DAMAGE
104 DPMS
105 DRI2
106 DRI3
107 EVENT
108 EWMH
109 GLX
110 ICCCM
111 IMAGE
112 KEYSYMS
113 PRESENT
114 RANDR
115 RECORD
116 RENDERUTIL
117 RES
118 SCREENSAVER
119 SYNC
120 UTIL
121 XEVIE
122 XF86DRI
123 XINERAMA
124 XINPUT
125 XKB
126 XPRINT
127 XTEST
128 XV
129 XVMC
130 )
131
132 # default component info: xcb components have fairly predictable
133 # header files, library names and pkg-config names
134 foreach(_comp ${XCB_known_components})
135 string(TOLOWER "${_comp}" _lc_comp)
136 set(XCB_${_comp}_component_deps XCB)
137 set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}")
138 set(XCB_${_comp}_lib "xcb-${_lc_comp}")
139 set(XCB_${_comp}_header "xcb/${_lc_comp}.h")
140 if(USE_XCB_${_comp}_STATIC)
141 set(XCB_${_comp}_lib "lib${XCB_${_comp}_lib}.a")
142 endif()
143 endforeach()
144 # exceptions
145 set(XCB_XCB_component_deps)
146 set(XCB_COMPOSITE_component_deps XCB XFIXES)
147 set(XCB_DAMAGE_component_deps XCB XFIXES)
148 set(XCB_IMAGE_component_deps XCB SHM AUX)
149 set(XCB_RENDERUTIL_component_deps XCB RENDER)
150 set(XCB_XFIXES_component_deps XCB RENDER SHAPE)
151 set(XCB_XVMC_component_deps XCB XV)
152 set(XCB_XV_component_deps XCB SHM)
153 set(XCB_XCB_pkg_config "xcb")
154 set(XCB_XCB_lib "xcb")
155 set(XCB_ATOM_header "xcb/xcb_atom.h")
156 set(XCB_ATOM_lib "xcb-util")
157 set(XCB_AUX_header "xcb/xcb_aux.h")
158 set(XCB_AUX_lib "xcb-util")
159 set(XCB_CURSOR_header "xcb/xcb_cursor.h")
160 set(XCB_EVENT_header "xcb/xcb_event.h")
161 set(XCB_EVENT_lib "xcb-util")
162 set(XCB_EWMH_header "xcb/xcb_ewmh.h")
163 set(XCB_ICCCM_header "xcb/xcb_icccm.h")
164 set(XCB_IMAGE_header "xcb/xcb_image.h")
165 set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h")
166 set(XCB_PIXEL_header "xcb/xcb_pixel.h")
167 set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h")
168 set(XCB_RENDERUTIL_lib "xcb-render-util")
169 set(XCB_UTIL_header "xcb/xcb_util.h")
170
171 ecm_find_package_parse_components(XCB
172 RESULT_VAR XCB_components
173 KNOWN_COMPONENTS ${XCB_known_components}
174 DEFAULT_COMPONENTS ${XCB_default_components}
175 )
176
177 ecm_find_package_handle_library_components(XCB
178 COMPONENTS ${XCB_components}
179 )
180
181 find_package_handle_standard_args(XCB
182 FOUND_VAR
183 XCB_FOUND
184 REQUIRED_VARS
185 XCB_LIBRARIES
186 VERSION_VAR
187 XCB_VERSION
188 HANDLE_COMPONENTS
189 )
190
191 include(FeatureSummary)
192 set_package_properties(XCB PROPERTIES
193 URL "https://xcb.freedesktop.org/"
194 DESCRIPTION "X protocol C-language Binding"
195 )