aboutsummaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindA2X.cmake75
-rw-r--r--CMake/FindDRM.cmake40
-rw-r--r--CMake/FindDbus.cmake42
-rw-r--r--CMake/FindEGL.cmake41
-rw-r--r--CMake/FindGBM.cmake39
-rw-r--r--CMake/FindGLESv2.cmake41
-rw-r--r--CMake/FindLibInput.cmake72
-rw-r--r--CMake/FindLibcap.cmake56
-rw-r--r--CMake/FindSystemd.cmake40
-rw-r--r--CMake/FindUdev.cmake40
-rw-r--r--CMake/FindWayland.cmake69
-rw-r--r--CMake/FindWaylandProtocols.cmake39
-rw-r--r--CMake/FindXKBCommon.cmake19
-rw-r--r--CMake/Manpage.cmake33
-rw-r--r--CMake/Wayland.cmake77
15 files changed, 723 insertions, 0 deletions
diff --git a/CMake/FindA2X.cmake b/CMake/FindA2X.cmake
new file mode 100644
index 00000000..b38f5086
--- /dev/null
+++ b/CMake/FindA2X.cmake
@@ -0,0 +1,75 @@
+#
+# (c)2015 KiCad Developers
+# (c)2015 Brian Sidebotham <brian.sidebotham@gmail.com>
+#
+# CMake module to find a2x (part of the asciidoc toolchain).
+#
+# Variables generated:
+#
+# A2X_FOUND true when A2X_COMMAND is valid
+# A2X_COMMAND The command to run a2x (may be a list including an interpreter)
+# A2X_VERSION The a2x version that has been found
+#
+
+# Have a go at finding a a2x executable
+find_program( A2X_PROGRAM a2x )
+
+# Found something, attempt to try and use it...
+if( A2X_PROGRAM )
+ execute_process(
+ COMMAND ${A2X_PROGRAM} --version
+ OUTPUT_VARIABLE _OUT
+ ERROR_VARIABLE _ERR
+ RESULT_VARIABLE _RES
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+
+ # If it worked, set the A2X_COMMAND
+ if( _RES MATCHES 0 )
+ set( A2X_COMMAND "${A2X_PROGRAM}" )
+ endif()
+endif()
+
+# If nothing could be found, test to see if we can just find the script file,
+# that we'll then run with the python interpreter
+if( NOT A2X_COMMAND )
+ find_file( A2X_SCRIPT a2x.py )
+
+ if( A2X_SCRIPT )
+ # Find the python interpreter quietly
+ if( NOT PYTHONINTERP_FOUND )
+ find_package( PYTHONINTERP QUIET )
+ endif()
+
+ if( NOT PYTHONINTERP_FOUND )
+ # Python's not available so can't find a2x...
+ set( A2X_COMMAND "" )
+ else()
+ # Build the python based command
+ set( A2X_COMMAND "${PYTHON_EXECUTABLE}" "${A2X_SCRIPT}" )
+
+ execute_process(
+ COMMAND ${A2X_COMMAND} --version
+ OUTPUT_VARIABLE _OUT
+ ERROR_VARIABLE _ERR
+ RESULT_VARIABLE _RES
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+
+ # If it still can't be run, then give up
+ if( NOT _RES MATCHES 0 )
+ set( A2X_COMMAND "" )
+ endif()
+ endif()
+ endif()
+endif()
+
+# If we've found a command that works, check the version
+if( A2X_COMMAND )
+ string(REGEX REPLACE ".*a2x[^0-9.]*\([0-9.]+\).*" "\\1" A2X_VERSION "${_OUT}")
+endif()
+
+# Generate the *_FOUND as necessary, etc.
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args(
+ A2X
+ REQUIRED_VARS A2X_COMMAND
+ VERSION_VAR A2X_VERSION )
diff --git a/CMake/FindDRM.cmake b/CMake/FindDRM.cmake
new file mode 100644
index 00000000..383647cd
--- /dev/null
+++ b/CMake/FindDRM.cmake
@@ -0,0 +1,40 @@
+#.rst:
+# FindDRM
+# -------
+#
+# Find DRM library
+#
+# Try to find DRM library on UNIX systems. The following values are defined
+#
+# ::
+#
+# DRM_FOUND - True if drm is available
+# DRM_INCLUDE_DIRS - Include directories for drm
+# DRM_LIBRARIES - List of libraries for drm
+# DRM_DEFINITIONS - List of definitions for drm
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(DRM PROPERTIES
+ URL "http://dri.freedesktop.org/"
+ DESCRIPTION "Kernel module that gives direct hardware access to DRI clients")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_DRM QUIET libdrm)
+find_library(DRM_LIBRARIES NAMES drm HINTS ${PC_DRM_LIBRARY_DIRS})
+find_path(DRM_INCLUDE_DIRS NAMES drm.h PATH_SUFFIXES libdrm drm HINTS ${PC_DRM_INCLUDE_DIRS})
+
+set(DRM_DEFINITIONS ${PC_DRM_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DRM DEFAULT_MSG DRM_INCLUDE_DIRS DRM_LIBRARIES)
+mark_as_advanced(DRM_INCLUDE_DIRS DRM_LIBRARIES DRM_DEFINITIONS)
diff --git a/CMake/FindDbus.cmake b/CMake/FindDbus.cmake
new file mode 100644
index 00000000..715e527b
--- /dev/null
+++ b/CMake/FindDbus.cmake
@@ -0,0 +1,42 @@
+#.rst:
+# FindDbus
+# -----------
+#
+# Find Dbus library
+#
+# Try to find Dbus library on UNIX systems. The following values are defined
+#
+# ::
+#
+# DBUS_FOUND - True if dbus is available
+# DBUS_INCLUDE_DIRS - Include directories for dbus
+# DBUS_LIBRARIES - List of libraries for dbus
+# DBUS_DEFINITIONS - List of definitions for dbus
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(Dbus PROPERTIES
+ URL "http://www.freedesktop.org/wiki/Software/dbus/"
+ DESCRIPTION "Message bus system")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_DBUS QUIET dbus-1)
+find_path(DBUS_SYSTEM_INCLUDES dbus/dbus.h PATH_SUFFIXES dbus-1.0)
+find_path(DBUS_LIB_INCLUDES dbus/dbus-arch-deps.h HINTS ${PC_DBUS_INCLUDE_DIRS} ${CMAKE_LIBRARY_PATH}/dbus-1.0/include ${CMAKE_SYSTEM_LIBRARY_PATH}/dbus-1.0/include)
+find_library(DBUS_LIBRARIES NAMES dbus-1 HINTS ${PC_DBUS_LIBRARY_DIRS})
+
+set(DBUS_INCLUDE_DIRS ${DBUS_SYSTEM_INCLUDES} ${DBUS_LIB_INCLUDES})
+set(DBUS_DEFINITIONS ${PC_DBUS_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DBUS DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
+mark_as_advanced(DBUS_INCLUDE_DIRS DBUS_LIBRARIES DBUS_SYSTEM_INCLUDES DBUS_LIB_INCLUDES DBUS_DEFINITIONS)
diff --git a/CMake/FindEGL.cmake b/CMake/FindEGL.cmake
new file mode 100644
index 00000000..c044d1ce
--- /dev/null
+++ b/CMake/FindEGL.cmake
@@ -0,0 +1,41 @@
+#.rst:
+# FindEGL
+# -------
+#
+# Find EGL library
+#
+# Try to find EGL library. The following values are defined
+#
+# ::
+#
+# EGL_FOUND - True if egl is available
+# EGL_INCLUDE_DIRS - Include directories for egl
+# EGL_LIBRARIES - List of libraries for egl
+# EGL_DEFINITIONS - List of definitions for egl
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(EGL PROPERTIES
+ URL "http://www.khronos.org/egl/"
+ DESCRIPTION "Native Platform Interface")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_EGL QUIET egl)
+find_library(EGL_LIBRARIES NAMES egl EGL HINTS ${PC_EGL_LIBRARY_DIRS})
+find_path(EGL_INCLUDE_DIRS NAMES EGL/egl.h HINTS ${PC_EGL_INCLUDE_DIRS})
+
+set(EGL_DEFINITIONS ${PC_EGL_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARIES EGL_INCLUDE_DIRS)
+mark_as_advanced(EGL_INCLUDE_DIRS EGL_LIBRARIES EGL_DEFINITIONS)
+
diff --git a/CMake/FindGBM.cmake b/CMake/FindGBM.cmake
new file mode 100644
index 00000000..85df1f7c
--- /dev/null
+++ b/CMake/FindGBM.cmake
@@ -0,0 +1,39 @@
+#.rst:
+# FindGBM
+# -------
+#
+# Find GBM library
+#
+# Try to find GBM library on UNIX systems. The following values are defined
+#
+# ::
+#
+# GBM_FOUND - True if gbm is available
+# GBM_INCLUDE_DIRS - Include directories for gbm
+# GBM_LIBRARIES - List of libraries for gbm
+# GBM_DEFINITIONS - List of definitions for gbm
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+set_package_properties(GBM PROPERTIES
+ URL "http://www.mesa3d.org/"
+ DESCRIPTION "Generic buffer manager")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_GBM QUIET gbm)
+find_library(GBM_LIBRARIES NAMES gbm HINTS ${PC_GBM_LIBRARY_DIRS})
+find_path(GBM_INCLUDE_DIRS gbm.h HINTS ${PC_GBM_INCLUDE_DIRS})
+
+set(GBM_DEFINITIONS ${PC_GBM_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GBM DEFAULT_MSG GBM_INCLUDE_DIRS GBM_LIBRARIES)
+mark_as_advanced(GBM_INCLUDE_DIRS GBM_LIBRARIES GBM_DEFINITIONS)
diff --git a/CMake/FindGLESv2.cmake b/CMake/FindGLESv2.cmake
new file mode 100644
index 00000000..c2120efa
--- /dev/null
+++ b/CMake/FindGLESv2.cmake
@@ -0,0 +1,41 @@
+#.rst:
+# FindGLESv2
+# -------
+#
+# Find GLESv2 library
+#
+# Try to find GLESv2 library. The following values are defined
+#
+# ::
+#
+# GLESv2_FOUND - True if glesv2 is available
+# GLESv2_INCLUDE_DIRS - Include directories for glesv2
+# GLESv2_LIBRARIES - List of libraries for glesv2
+# GLESv2_DEFINITIONS - List of definitions for glesv2
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(GLESv2 PROPERTIES
+ URL "https://www.khronos.org/opengles/"
+ DESCRIPTION "The Standard for Embedded Accelerated 3D Graphics")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_GLES2 QUIET glesv2)
+find_library(GLESv2_LIBRARIES NAMES GLESv2 ${PC_GLES2_LIBRARY_DIRS})
+find_path(GLESv2_INCLUDE_DIRS NAMES GLES2/gl2.h HINTS ${PC_GLES2_INCLUDE_DIRS})
+
+set(GLESv2_DEFINITIONS ${PC_GLES2_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARIES GLESv2_INCLUDE_DIRS)
+mark_as_advanced(GLESv2_INCLUDE_DIRS GLESv2_LIBRARIES GLESv2_DEFINITIONS)
+
diff --git a/CMake/FindLibInput.cmake b/CMake/FindLibInput.cmake
new file mode 100644
index 00000000..8e3b222b
--- /dev/null
+++ b/CMake/FindLibInput.cmake
@@ -0,0 +1,72 @@
+#.rst:
+# FindLibInput
+# -------
+#
+# Find LibInput library
+#
+# Try to find LibInpu library. The following values are defined
+#
+# ::
+#
+# LIBINPUT_FOUND - True if libinput is available
+# LIBINPUT_INCLUDE_DIRS - Include directories for libinput
+# LIBINPUT_LIBRARIES - List of libraries for libinput
+# LIBINPUT_DEFINITIONS - List of definitions for libinput
+#
+# and also the following more fine grained variables
+#
+# ::
+#
+# LIBINPUT_VERSION
+# LIBINPUT_VERSION_MAJOR
+# LIBINPUT_VERSION_MINOR
+# LIBINPUT_VERSION_MICRO
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(LibInput PROPERTIES
+ URL "http://freedesktop.org/wiki/Software/libinput/"
+ DESCRIPTION "Library to handle input devices")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_INPUT QUIET libinput)
+find_library(LIBINPUT_LIBRARIES NAMES input HINTS ${PC_INPUT_LIBRARY_DIRS})
+find_path(LIBINPUT_INCLUDE_DIRS libinput.h HINTS ${PC_INPUT_INCLUDE_DIRS})
+
+set(LIBINPUT_VERSION ${PC_INPUT_VERSION})
+string(REPLACE "." ";" VERSION_LIST "${PC_INPUT_VERSION}")
+
+LIST(LENGTH VERSION_LIST n)
+if (n EQUAL 3)
+ list(GET VERSION_LIST 0 LIBINPUT_VERSION_MAJOR)
+ list(GET VERSION_LIST 1 LIBINPUT_VERSION_MINOR)
+ list(GET VERSION_LIST 2 LIBINPUT_VERSION_MICRO)
+else ()
+ set(LIBINPUT_VERSION "9999.9999.9999")
+ set(LIBINPUT_VERSION_MAJOR 9999)
+ set(LIBINPUT_VERSION_MINOR 9999)
+ set(LIBINPUT_VERSION_MICRO 9999)
+ message(WARNING "Could not detect libinput version, assuming you have recent one")
+endif ()
+
+# This is compatible with libinput-version.h that exists in upstream
+# but isn't in distribution (probably forgotten)
+set(LIBINPUT_DEFINITIONS ${PC_INPUT_CFLAGS_OTHER}
+ -DLIBINPUT_VERSION=\"${LIBINPUT_VERSION}\"
+ -DLIBINPUT_VERSION_MAJOR=${LIBINPUT_VERSION_MAJOR}
+ -DLIBINPUT_VERSION_MINOR=${LIBINPUT_VERSION_MINOR}
+ -DLIBINPUT_VERSION_MICRO=${LIBINPUT_VERSION_MICRO})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LIBINPUT DEFAULT_MSG LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES)
+mark_as_advanced(LIBINPUT_INCLUDE_DIRS LIBINPUT_LIBRARIES LIBINPUT_DEFINITIONS
+ LIBINPUT_VERSION LIBINPUT_VERSION_MAJOR LIBINPUT_VERSION_MICRO LIBINPUT_VERSION_MINOR)
diff --git a/CMake/FindLibcap.cmake b/CMake/FindLibcap.cmake
new file mode 100644
index 00000000..b34e5e37
--- /dev/null
+++ b/CMake/FindLibcap.cmake
@@ -0,0 +1,56 @@
+#.rst:
+# FindLibcap
+# -------
+#
+# Find Libcap library
+#
+# Try to find Libcap library. The following values are defined
+#
+# ::
+#
+# Libcap_FOUND - True if Libcap is available
+# Libcap_INCLUDE_DIRS - Include directories for Libcap
+# Libcap_LIBRARIES - List of libraries for Libcap
+# Libcap_DEFINITIONS - List of definitions for Libcap
+#
+# and also the following more fine grained variables
+#
+# ::
+#
+# Libcap_VERSION
+# Libcap_VERSION_MAJOR
+# Libcap_VERSION_MINOR
+#
+#=============================================================================
+# Copyright (c) 2017 Jerzi Kaminsky
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(Libcap PROPERTIES
+ URL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2"
+ DESCRIPTION "Library for getting and setting POSIX.1e capabilities")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_CAP QUIET Libcap)
+find_library(Libcap_LIBRARIES NAMES cap HINTS ${PC_CAP_LIBRARY_DIRS})
+find_path(Libcap_INCLUDE_DIRS sys/capability.h HINTS ${PC_CAP_INCLUDE_DIRS})
+
+set(Libcap_VERSION ${PC_CAP_VERSION})
+string(REPLACE "." ";" VERSION_LIST "${PC_CAP_VERSION}")
+
+LIST(LENGTH VERSION_LIST n)
+if (n EQUAL 2)
+ list(GET VERSION_LIST 0 Libcap_VERSION_MAJOR)
+ list(GET VERSION_LIST 1 Libcap_VERSION_MINOR)
+endif ()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libcap DEFAULT_MSG Libcap_INCLUDE_DIRS Libcap_LIBRARIES)
+mark_as_advanced(Libcap_INCLUDE_DIRS Libcap_LIBRARIES Libcap_DEFINITIONS
+ Libcap_VERSION Libcap_VERSION_MAJOR Libcap_VERSION_MICRO Libcap_VERSION_MINOR)
diff --git a/CMake/FindSystemd.cmake b/CMake/FindSystemd.cmake
new file mode 100644
index 00000000..09d60115
--- /dev/null
+++ b/CMake/FindSystemd.cmake
@@ -0,0 +1,40 @@
+#.rst:
+# FindSystemd
+# -------
+#
+# Find Systemd library
+#
+# Try to find Systemd library on UNIX systems. The following values are defined
+#
+# ::
+#
+# SYSTEMD_FOUND - True if Systemd is available
+# SYSTEMD_INCLUDE_DIRS - Include directories for Systemd
+# SYSTEMD_LIBRARIES - List of libraries for Systemd
+# SYSTEMD_DEFINITIONS - List of definitions for Systemd
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(Systemd PROPERTIES
+ URL "http://freedesktop.org/wiki/Software/systemd/"
+ DESCRIPTION "System and Service Manager")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_SYSTEMD QUIET libsystemd)
+find_library(SYSTEMD_LIBRARIES NAMES systemd ${PC_SYSTEMD_LIBRARY_DIRS})
+find_path(SYSTEMD_INCLUDE_DIRS systemd/sd-login.h HINTS ${PC_SYSTEMD_INCLUDE_DIRS})
+
+set(SYSTEMD_DEFINITIONS ${PC_SYSTEMD_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SYSTEMD DEFAULT_MSG SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
+mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES SYSTEMD_DEFINITIONS)
diff --git a/CMake/FindUdev.cmake b/CMake/FindUdev.cmake
new file mode 100644
index 00000000..dd97d8e0
--- /dev/null
+++ b/CMake/FindUdev.cmake
@@ -0,0 +1,40 @@
+#.rst:
+# FindUdev
+# -------
+#
+# Find udev library
+#
+# Try to find udev library on UNIX systems. The following values are defined
+#
+# ::
+#
+# UDEV_FOUND - True if udev is available
+# UDEV_INCLUDE_DIRS - Include directories for udev
+# UDEV_LIBRARIES - List of libraries for udev
+# UDEV_DEFINITIONS - List of definitions for udev
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(Udev PROPERTIES
+ URL "https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html"
+ DESCRIPTION "Device manager for the Linux kernel")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_UDEV QUIET libudev)
+find_library(UDEV_LIBRARIES NAMES udev HINTS ${PC_UDEV_LIBRARY_DIRS})
+find_path(UDEV_INCLUDE_DIRS libudev.h HINTS ${PC_UDEV_INCLUDE_DIRS})
+
+set(UDEV_DEFINITIONS ${PC_UDEV_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UDEV DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES)
+mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES UDEV_DEFINITIONS)
diff --git a/CMake/FindWayland.cmake b/CMake/FindWayland.cmake
new file mode 100644
index 00000000..465d2665
--- /dev/null
+++ b/CMake/FindWayland.cmake
@@ -0,0 +1,69 @@
+#.rst:
+# FindWayland
+# -----------
+#
+# Find Wayland installation
+#
+# Try to find Wayland. The following values are defined
+#
+# ::
+#
+# WAYLAND_FOUND - True if Wayland is found
+# WAYLAND_LIBRARIES - Link these to use Wayland
+# WAYLAND_INCLUDE_DIRS - Include directories for Wayland
+# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
+#
+# and also the following more fine grained variables:
+#
+# ::
+#
+# WAYLAND_CLIENT_FOUND, WAYLAND_CLIENT_INCLUDE_DIRS, WAYLAND_CLIENT_LIBRARIES
+# WAYLAND_SERVER_FOUND, WAYLAND_SERVER_INCLUDE_DIRS, WAYLAND_SERVER_LIBRARIES
+# WAYLAND_EGL_FOUND, WAYLAND_EGL_INCLUDE_DIRS, WAYLAND_EGL_LIBRARIES
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+# 2013 Martin Gräßlin <mgraesslin@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(Wayland PROPERTIES
+ URL "http://wayland.freedesktop.org/"
+ DESCRIPTION "Protocol for implementing compositors")
+
+find_package(PkgConfig)
+pkg_check_modules(PC_WAYLAND QUIET wayland-client>=1.7 wayland-server>=1.7 wayland-egl)
+
+find_library(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PC_WAYLAND_LIBRARY_DIRS})
+find_library(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PC_WAYLAND_LIBRARY_DIRS})
+find_library(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PC_WAYLAND_LIBRARY_DIRS})
+
+find_path(WAYLAND_CLIENT_INCLUDE_DIRS NAMES wayland-client.h HINTS ${PC_WAYLAND_INCLUDE_DIRS})
+find_path(WAYLAND_SERVER_INCLUDE_DIRS NAMES wayland-server.h HINTS ${PC_WAYLAND_INCLUDE_DIRS})
+find_path(WAYLAND_EGL_INCLUDE_DIRS NAMES wayland-egl.h HINTS ${PC_WAYLAND_INCLUDE_DIRS})
+
+set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIRS} ${WAYLAND_SERVER_INCLUDE_DIRS} ${WAYLAND_EGL_INCLUDE_DIRS})
+set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
+set(WAYLAND_DEFINITIONS ${PC_WAYLAND_CFLAGS})
+
+list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIRS)
+find_package_handle_standard_args(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIRS)
+find_package_handle_standard_args(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIRS)
+find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIRS)
+
+mark_as_advanced(
+ WAYLAND_INCLUDE_DIRS WAYLAND_LIBRARIES
+ WAYLAND_CLIENT_INCLUDE_DIRS WAYLAND_CLIENT_LIBRARIES
+ WAYLAND_SERVER_INCLUDE_DIRS WAYLAND_SERVER_LIBRARIES
+ WAYLAND_EGL_INCLUDE_DIRS WAYLAND_EGL_LIBRARIES
+ WAYLAND_DEFINITIONS
+ )
diff --git a/CMake/FindWaylandProtocols.cmake b/CMake/FindWaylandProtocols.cmake
new file mode 100644
index 00000000..8a8129b5
--- /dev/null
+++ b/CMake/FindWaylandProtocols.cmake
@@ -0,0 +1,39 @@
+#.rst:
+# FindWaylandProtocols
+# -------
+#
+# Find wayland protocol description files
+#
+# Try to find wayland protocol files. The following values are defined
+#
+# ::
+#
+# WAYLANDPROTOCOLS_FOUND - True if wayland protocol files are available
+# WAYLANDPROTOCOLS_PATH - Path to wayland protocol files
+#
+#=============================================================================
+# Copyright (c) 2015 Jari Vetoniemi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+include(FeatureSummary)
+set_package_properties(WaylandProtocols PROPERTIES
+ URL "https://cgit.freedesktop.org/wayland/wayland-protocols"
+ DESCRIPTION "Wayland protocol development")
+
+unset(WAYLANDPROTOCOLS_PATH)
+
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
+ OUTPUT_VARIABLE WAYLANDPROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif ()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WaylandProtocols DEFAULT_MSG WAYLANDPROTOCOLS_PATH)
+mark_as_advanced(WAYLANDPROTOCOLS_PATH)
diff --git a/CMake/FindXKBCommon.cmake b/CMake/FindXKBCommon.cmake
new file mode 100644
index 00000000..30ac503a
--- /dev/null
+++ b/CMake/FindXKBCommon.cmake
@@ -0,0 +1,19 @@
+# - Find XKBCommon
+# Once done, this will define
+#
+# XKBCOMMON_FOUND - System has XKBCommon
+# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories
+# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon
+# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon
+
+find_package(PkgConfig)
+pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon)
+find_path(XKBCOMMON_INCLUDE_DIRS NAMES xkbcommon/xkbcommon.h HINTS ${PC_XKBCOMMON_INCLUDE_DIRS})
+find_library(XKBCOMMON_LIBRARIES NAMES xkbcommon HINTS ${PC_XKBCOMMON_LIBRARY_DIRS})
+
+set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XKBCOMMON DEFAULT_MSG XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS)
+mark_as_advanced(XKBCOMMON_LIBRARIES XKBCOMMON_INCLUDE_DIRS)
+
diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake
new file mode 100644
index 00000000..cc04d710
--- /dev/null
+++ b/CMake/Manpage.cmake
@@ -0,0 +1,33 @@
+find_package(A2X)
+
+if (A2X_FOUND)
+ add_custom_target(man ALL)
+
+ function(add_manpage name section)
+ add_custom_command(
+ OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
+ COMMAND ${A2X_COMMAND}
+ --no-xmllint
+ --doctype manpage
+ --format manpage
+ -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
+ COMMENT Generating manpage for ${name}.${section}
+ )
+
+ add_custom_target(man-${name}.${section}
+ DEPENDS
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
+ )
+ add_dependencies(man
+ man-${name}.${section}
+ )
+
+ install(
+ FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
+ DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/man/man${section}
+ COMPONENT documentation
+ )
+ endfunction()
+endif()
diff --git a/CMake/Wayland.cmake b/CMake/Wayland.cmake
new file mode 100644
index 00000000..6647c5ee
--- /dev/null
+++ b/CMake/Wayland.cmake
@@ -0,0 +1,77 @@
+#=============================================================================
+# Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Pier Luigi Fiorini nor the names of his
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#=============================================================================
+
+find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
+
+# wayland_add_protocol_client(outfiles inputfile basename)
+function(WAYLAND_ADD_PROTOCOL_CLIENT _sources _protocol _basename)
+ if(NOT WAYLAND_SCANNER_EXECUTABLE)
+ message(FATAL "The wayland-scanner executable has not been found on your system. You must install it.")
+ endif()
+
+ get_filename_component(_infile ${_protocol} ABSOLUTE)
+ set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-client-protocol.h")
+ set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c")
+
+ add_custom_command(OUTPUT "${_client_header}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${_infile} > ${_client_header}
+ DEPENDS ${_infile} VERBATIM)
+
+ add_custom_command(OUTPUT "${_code}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code}
+ DEPENDS ${_infile} VERBATIM)
+
+ list(APPEND ${_sources} "${_client_header}" "${_code}")
+ set(${_sources} ${${_sources}} PARENT_SCOPE)
+endfunction()
+
+# wayland_add_protocol_server(outfiles inputfile basename)
+function(WAYLAND_ADD_PROTOCOL_SERVER _sources _protocol _basename)
+ if(NOT WAYLAND_SCANNER_EXECUTABLE)
+ message(FATAL "The wayland-scanner executable has not been found on your system. You must install it.")
+ endif()
+
+ get_filename_component(_infile ${_protocol} ABSOLUTE)
+ set(_server_header "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h")
+ set(_code "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-protocol.c")
+
+ add_custom_command(OUTPUT "${_server_header}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header < ${_infile} > ${_server_header}
+ DEPENDS ${_infile} VERBATIM)
+
+ add_custom_command(OUTPUT "${_code}"
+ COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code < ${_infile} > ${_code}
+ DEPENDS ${_infile} VERBATIM)
+
+ list(APPEND ${_sources} "${_server_header}" "${_code}")
+ set(${_sources} ${${_sources}} PARENT_SCOPE)
+endfunction()