|
| 1 | +#.rst: |
| 2 | +# FindXCB |
| 3 | +# ------- |
| 4 | +# |
| 5 | +# Find XCB libraries |
| 6 | +# |
| 7 | +# Tries to find xcb libraries on unix systems. |
| 8 | +# |
| 9 | +# - Be sure to set the COMPONENTS to the components you want to link to |
| 10 | +# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list |
| 11 | +# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable |
| 12 | +# |
| 13 | +# The following values are defined |
| 14 | +# |
| 15 | +# :: |
| 16 | +# |
| 17 | +# XCB_FOUND - True if xcb is available |
| 18 | +# XCB_INCLUDE_DIRS - Include directories for xcb |
| 19 | +# XCB_LIBRARIES - List of libraries for xcb |
| 20 | +# XCB_DEFINITIONS - List of definitions for xcb |
| 21 | +# |
| 22 | +#============================================================================= |
| 23 | +# Copyright (c) 2015 Jari Vetoniemi |
| 24 | +# |
| 25 | +# Distributed under the OSI-approved BSD License (the "License"); |
| 26 | +# |
| 27 | +# This software is distributed WITHOUT ANY WARRANTY; without even the |
| 28 | +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 29 | +# See the License for more information. |
| 30 | +#============================================================================= |
| 31 | + |
| 32 | +include(FeatureSummary) |
| 33 | +set_package_properties(XCB PROPERTIES |
| 34 | + URL "https://xcb.freedesktop.org/" |
| 35 | + DESCRIPTION "X protocol C-language Binding") |
| 36 | + |
| 37 | +find_package(PkgConfig) |
| 38 | +pkg_check_modules(PC_XCB xcb ${XCB_FIND_COMPONENTS}) |
| 39 | + |
| 40 | +find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS}) |
| 41 | +find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS}) |
| 42 | + |
| 43 | +foreach(COMPONENT ${XCB_FIND_COMPONENTS}) |
| 44 | + find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS}) |
| 45 | + list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}}) |
| 46 | + mark_as_advanced(XCB_LIBRARIES_${COMPONENT}) |
| 47 | +endforeach(COMPONENT ${XCB_FIND_COMPONENTS}) |
| 48 | + |
| 49 | +set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER}) |
| 50 | + |
| 51 | +include(FindPackageHandleStandardArgs) |
| 52 | +find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS) |
| 53 | +mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS) |
0 commit comments