blob: a52f86f912dc5ff90bc8f0020885548ef91fe94e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#.rst:
# FindX
# -----
# Finds the X11 library
#
# This will define the following variables::
#
# X_FOUND - system has X11
# X_INCLUDE_DIRS - the X11 include directory
# X_LIBRARIES - the X11 libraries
# X_DEFINITIONS - the X11 definitions
#
# and the following imported targets::
#
# X::X - The X11 library
# X::Xext - The X11 extension library
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_X x11 xext QUIET)
endif()
find_path(X_INCLUDE_DIR NAMES X11/Xlib.h
PATHS ${PC_X_x11_INCLUDEDIR})
find_library(X_LIBRARY NAMES X11
PATHS ${PC_X_x11_LIBDIR})
find_library(X_EXT_LIBRARY NAMES Xext
PATHS ${PC_X_xext_LIBDIR})
set(X_VERSION ${PC_X_x11_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(X
REQUIRED_VARS X_LIBRARY X_EXT_LIBRARY X_INCLUDE_DIR
VERSION_VAR X_VERSION)
if(X_FOUND)
set(X_LIBRARIES ${X_LIBRARY} ${X_EXT_LIBRARY})
set(X_INCLUDE_DIRS ${X_INCLUDE_DIR})
set(X_DEFINITIONS -DHAVE_X11=1)
if(NOT TARGET X::X)
add_library(X::X UNKNOWN IMPORTED)
set_target_properties(X::X PROPERTIES
IMPORTED_LOCATION "${X_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${X_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS HAVE_X11=1)
endif()
if(NOT TARGET X::Xext)
add_library(X::Xext UNKNOWN IMPORTED)
set_target_properties(X::Xext PROPERTIES
IMPORTED_LOCATION "${X_EXT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${X_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES X::X)
endif()
endif()
mark_as_advanced(X_INCLUDE_DIR X_LIBRARY X_EXT_LIBRARY)
|