diff options
author | Cole Mickens <cole.mickens@gmail.com> | 2016-01-17 02:53:37 -0800 |
---|---|---|
committer | Cole Mickens <cole.mickens@gmail.com> | 2016-01-19 06:51:36 -0800 |
commit | 28081b76891ddbbb825dee6c202037d78aa8f164 (patch) | |
tree | 6b7412f626f5d9f10dba8920a2543dfd3c5a662e /CMake | |
parent | Add ffmpeg/imagemagick to depenency list (diff) | |
download | sway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.gz sway-28081b76891ddbbb825dee6c202037d78aa8f164.tar.zst sway-28081b76891ddbbb825dee6c202037d78aa8f164.zip |
libinput
Diffstat (limited to 'CMake')
-rw-r--r-- | CMake/FindLibInput.cmake | 66 |
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 | |||
35 | include(FeatureSummary) | ||
36 | set_package_properties(LibInput PROPERTIES | ||
37 | URL "http://freedesktop.org/wiki/Software/libinput/" | ||
38 | DESCRIPTION "Library to handle input devices") | ||
39 | |||
40 | find_package(PkgConfig) | ||
41 | pkg_check_modules(PC_INPUT QUIET libinput) | ||
42 | find_library(LIBINPUT_LIBRARIES NAMES input HINTS ${PC_INPUT_LIBRARY_DIRS}) | ||
43 | find_path(LIBINPUT_INCLUDE_DIRS libinput.h HINTS ${PC_INPUT_INCLUDE_DIRS}) | ||
44 | |||
45 | set(LIBINPUT_VERSION ${PC_INPUT_VERSION}) | ||
46 | string(REPLACE "." ";" VERSION_LIST "${PC_INPUT_VERSION}") | ||
47 | |||
48 | LIST(LENGTH VERSION_LIST n) | ||
49 | if (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) | ||
53 | endif () | ||
54 | |||
55 | # This is compatible with libinput-version.h that exists in upstream | ||
56 | # but isn't in distribution (probably forgotten) | ||
57 | set(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 | |||
63 | include(FindPackageHandleStandardArgs) | ||
64 | find_package_handle_standard_args(LIBINPUT DEFAULT_MSG LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES) | ||
65 | mark_as_advanced(LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES LIBINPUT_DEFINITIONS | ||
66 | LIBINPUT_VERSION LIBINPUT_VERSION_MAJOR LIBINPUT_VERSION_MICRO LIBINPUT_VERSION_MINOR) | ||