summaryrefslogtreecommitdiffstats
path: root/CMake
diff options
context:
space:
mode:
authorLibravatar Cole Mickens <cole.mickens@gmail.com>2016-01-17 02:53:37 -0800
committerLibravatar Cole Mickens <cole.mickens@gmail.com>2016-01-19 06:51:36 -0800
commit28081b76891ddbbb825dee6c202037d78aa8f164 (patch)
tree6b7412f626f5d9f10dba8920a2543dfd3c5a662e /CMake
parentAdd ffmpeg/imagemagick to depenency list (diff)
downloadsway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.gz
sway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.zst
sway-28081b76891ddbbb825dee6c202037d78aa8f164.zip
libinput
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindLibInput.cmake66
1 files changed, 66 insertions, 0 deletions
diff --git a/CMake/FindLibInput.cmake b/CMake/FindLibInput.cmake
new file mode 100644
index 00000000..87721998
--- /dev/null
+++ b/CMake/FindLibInput.cmake
@@ -0,0 +1,66 @@
1#.rst:
2# FindLibInput
3# -------
4#
5# Find LibInput library
6#
7# Try to find LibInpu library. The following values are defined
8#
9# ::
10#
11# LIBINPUT_FOUND - True if libinput is available
12# LIBINPUT_INCLUDE_DIRS - Include directories for libinput
13# LIBINPUT_LIBRARIES - List of libraries for libinput
14# LIBINPUT_DEFINITIONS - List of definitions for libinput
15#
16# and also the following more fine grained variables
17#
18# ::
19#
20# LIBINPUT_VERSION
21# LIBINPUT_VERSION_MAJOR
22# LIBINPUT_VERSION_MINOR
23# LIBINPUT_VERSION_MICRO
24#
25#=============================================================================
26# Copyright (c) 2015 Jari Vetoniemi
27#
28# Distributed under the OSI-approved BSD License (the "License");
29#
30# This software is distributed WITHOUT ANY WARRANTY; without even the
31# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
32# See the License for more information.
33#=============================================================================
34
35include(FeatureSummary)
36set_package_properties(LibInput PROPERTIES
37 URL "http://freedesktop.org/wiki/Software/libinput/"
38 DESCRIPTION "Library to handle input devices")
39
40find_package(PkgConfig)
41pkg_check_modules(PC_INPUT QUIET libinput)
42find_library(LIBINPUT_LIBRARIES NAMES input HINTS ${PC_INPUT_LIBRARY_DIRS})
43find_path(LIBINPUT_INCLUDE_DIRS libinput.h HINTS ${PC_INPUT_INCLUDE_DIRS})
44
45set(LIBINPUT_VERSION ${PC_INPUT_VERSION})
46string(REPLACE "." ";" VERSION_LIST "${PC_INPUT_VERSION}")
47
48LIST(LENGTH VERSION_LIST n)
49if (n EQUAL 3)
50 list(GET VERSION_LIST 0 LIBINPUT_VERSION_MAJOR)
51 list(GET VERSION_LIST 1 LIBINPUT_VERSION_MINOR)
52 list(GET VERSION_LIST 2 LIBINPUT_VERSION_MICRO)
53endif ()
54
55# This is compatible with libinput-version.h that exists in upstream
56# but isn't in distribution (probably forgotten)
57set(LIBINPUT_DEFINITIONS ${PC_INPUT_CFLAGS_OTHER}
58 -DLIBINPUT_VERSION=\"${LIBINPUT_VERSION}\"
59 -DLIBINPUT_VERSION_MAJOR=${LIBINPUT_VERSION_MAJOR}
60 -DLIBINPUT_VERSION_MINOR=${LIBINPUT_VERSION_MINOR}
61 -DLIBINPUT_VERSION_MICRO=${LIBINPUT_VERSION_MICRO})
62
63include(FindPackageHandleStandardArgs)
64find_package_handle_standard_args(LIBINPUT DEFAULT_MSG LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES)
65mark_as_advanced(LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES LIBINPUT_DEFINITIONS
66 LIBINPUT_VERSION LIBINPUT_VERSION_MAJOR LIBINPUT_VERSION_MICRO LIBINPUT_VERSION_MINOR)