Warning, /frameworks/extra-cmake-modules/find-modules/FindXCB.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2011 Fredrik Höglund <fredrik@kde.org>
0002 # SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0003 # SPDX-FileCopyrightText: 2014-2015 Alex Merry <alex.merry@kde.org>
0004 #
0005 # SPDX-License-Identifier: BSD-3-Clause
0006 
0007 #[=======================================================================[.rst:
0008 FindXCB
0009 -------
0010 
0011 Try to find XCB.
0012 
0013 This is a component-based find module, which makes use of the COMPONENTS and
0014 OPTIONAL_COMPONENTS arguments to find_module.  The following components are
0015 available::
0016 
0017   XCB
0018   ATOM         AUX          COMPOSITE    CURSOR       DAMAGE
0019   DPMS         DRI2         DRI3         EVENT        EWMH
0020   GLX          ICCCM        IMAGE        KEYSYMS      PRESENT
0021   RANDR        RECORD       RENDER       RENDERUTIL   RES
0022   SCREENSAVER  SHAPE        SHM          SYNC         UTIL
0023   XF86DRI      XFIXES       XINERAMA     XINPUT       XKB
0024   XTEST        XV           XVMC
0025 
0026 If no components are specified, this module will act as though all components
0027 were passed to OPTIONAL_COMPONENTS. Before 5.82 this excluded XINPUT. Since 5.82
0028 all components are searched for.
0029 
0030 This module will define the following variables, independently of the
0031 components searched for or found:
0032 
0033 ``XCB_FOUND``
0034     True if (the requestion version of) xcb is available
0035 ``XCB_VERSION``
0036     Found xcb version
0037 ``XCB_TARGETS``
0038     A list of all targets imported by this module (note that there may be more
0039     than the components that were requested)
0040 ``XCB_LIBRARIES``
0041     This can be passed to target_link_libraries() instead of the imported
0042     targets
0043 ``XCB_INCLUDE_DIRS``
0044     This should be passed to target_include_directories() if the targets are
0045     not used for linking
0046 ``XCB_DEFINITIONS``
0047     This should be passed to target_compile_options() if the targets are not
0048     used for linking
0049 
0050 For each searched-for components, ``XCB_<component>_FOUND`` will be set to
0051 true if the corresponding xcb library was found, and false otherwise.  If
0052 ``XCB_<component>_FOUND`` is true, the imported target ``XCB::<component>``
0053 will be defined.  This module will also attempt to determine
0054 ``XCB_*_VERSION`` variables for each imported target, although
0055 ``XCB_VERSION`` should normally be sufficient.
0056 
0057 In general we recommend using the imported targets, as they are easier to use
0058 and provide more control.  Bear in mind, however, that if any target is in the
0059 link interface of an exported library, it must be made available by the
0060 package config file.
0061 
0062 Since pre-1.0.0.
0063 #]=======================================================================]
0064 
0065 include(${CMAKE_CURRENT_LIST_DIR}/ECMFindModuleHelpersStub.cmake)
0066 
0067 ecm_find_package_version_check(XCB)
0068 
0069 # Note that this list needs to be ordered such that any component
0070 # appears after its dependencies
0071 set(XCB_known_components
0072     XCB
0073     RENDER
0074     SHAPE
0075     XFIXES
0076     SHM
0077     ATOM
0078     AUX
0079     COMPOSITE
0080     CURSOR
0081     DAMAGE
0082     DPMS
0083     DRI2
0084     DRI3
0085     EVENT
0086     EWMH
0087     GLX
0088     ICCCM
0089     IMAGE
0090     KEYSYMS
0091     PRESENT
0092     RANDR
0093     RECORD
0094     RENDERUTIL
0095     RES
0096     SCREENSAVER
0097     SYNC
0098     UTIL
0099     XF86DRI
0100     XINERAMA
0101     XINPUT
0102     XKB
0103     XTEST
0104     XV
0105     XVMC
0106 )
0107 
0108 # default component info: xcb components have fairly predictable
0109 # header files, library names and pkg-config names
0110 foreach(_comp ${XCB_known_components})
0111     string(TOLOWER "${_comp}" _lc_comp)
0112     set(XCB_${_comp}_component_deps XCB)
0113     set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}")
0114     set(XCB_${_comp}_lib "xcb-${_lc_comp}")
0115     set(XCB_${_comp}_header "xcb/${_lc_comp}.h")
0116 endforeach()
0117 # exceptions
0118 set(XCB_XCB_component_deps)
0119 set(XCB_COMPOSITE_component_deps XCB XFIXES)
0120 set(XCB_DAMAGE_component_deps XCB XFIXES)
0121 set(XCB_IMAGE_component_deps XCB SHM)
0122 set(XCB_RENDERUTIL_component_deps XCB RENDER)
0123 set(XCB_XFIXES_component_deps XCB RENDER SHAPE)
0124 set(XCB_XVMC_component_deps XCB XV)
0125 set(XCB_XV_component_deps XCB SHM)
0126 set(XCB_XCB_pkg_config "xcb")
0127 set(XCB_XCB_lib "xcb")
0128 set(XCB_ATOM_header "xcb/xcb_atom.h")
0129 set(XCB_ATOM_lib "xcb-util")
0130 set(XCB_AUX_header "xcb/xcb_aux.h")
0131 set(XCB_AUX_lib "xcb-util")
0132 set(XCB_CURSOR_header "xcb/xcb_cursor.h")
0133 set(XCB_EVENT_header "xcb/xcb_event.h")
0134 set(XCB_EVENT_lib "xcb-util")
0135 set(XCB_EWMH_header "xcb/xcb_ewmh.h")
0136 set(XCB_ICCCM_header "xcb/xcb_icccm.h")
0137 set(XCB_IMAGE_header "xcb/xcb_image.h")
0138 set(XCB_KEYSYMS_header "xcb/xcb_keysyms.h")
0139 set(XCB_PIXEL_header "xcb/xcb_pixel.h")
0140 set(XCB_RENDERUTIL_header "xcb/xcb_renderutil.h")
0141 set(XCB_RENDERUTIL_lib "xcb-render-util")
0142 set(XCB_UTIL_header "xcb/xcb_util.h")
0143 
0144 ecm_find_package_parse_components(XCB
0145     RESULT_VAR XCB_components
0146     KNOWN_COMPONENTS ${XCB_known_components}
0147     DEFAULT_COMPONENTS ${XCB_default_components}
0148 )
0149 
0150 ecm_find_package_handle_library_components(XCB
0151     COMPONENTS ${XCB_components}
0152 )
0153 
0154 find_package_handle_standard_args(XCB
0155     FOUND_VAR
0156         XCB_FOUND
0157     REQUIRED_VARS
0158         XCB_LIBRARIES
0159     VERSION_VAR
0160         XCB_VERSION
0161     HANDLE_COMPONENTS
0162 )
0163 
0164 include(FeatureSummary)
0165 set_package_properties(XCB PROPERTIES
0166     URL "https://xcb.freedesktop.org/"
0167     DESCRIPTION "X protocol C-language Binding"
0168 )