summaryrefslogtreecommitdiffstats
path: root/CMake/FindWayland.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'CMake/FindWayland.cmake')
-rw-r--r--CMake/FindWayland.cmake62
1 files changed, 62 insertions, 0 deletions
diff --git a/CMake/FindWayland.cmake b/CMake/FindWayland.cmake
new file mode 100644
index 00000000..00c17a3c
--- /dev/null
+++ b/CMake/FindWayland.cmake
@@ -0,0 +1,62 @@
1# Try to find Wayland on a Unix system
2#
3# This will define:
4#
5# WAYLAND_FOUND - True if Wayland is found
6# WAYLAND_LIBRARIES - Link these to use Wayland
7# WAYLAND_INCLUDE_DIR - Include directory for Wayland
8# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
9#
10# In addition the following more fine grained variables will be defined:
11#
12# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
13# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
14# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
15#
16# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
17#
18# Redistribution and use is allowed according to the terms of the BSD license.
19# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
20
21IF (NOT WIN32)
22 IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
23 # In the cache already
24 SET(WAYLAND_FIND_QUIETLY TRUE)
25 ENDIF ()
26
27 # Use pkg-config to get the directories and then use these values
28 # in the FIND_PATH() and FIND_LIBRARY() calls
29 FIND_PACKAGE(PkgConfig)
30 PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl)
31
32 SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
33
34 FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
35 FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
36 FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
37
38 FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
39 FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
40 FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
41
42 set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR})
43
44 set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
45
46 list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
47
48 include(FindPackageHandleStandardArgs)
49
50 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
51 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
52 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
53 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
54
55 MARK_AS_ADVANCED(
56 WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
57 WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
58 WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
59 WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
60 )
61
62ENDIF ()