1 # Try to find Wayland on a Unix system
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
10 # In addition the following more fine grained variables will be defined:
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
16 # Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
18 # Redistribution and use is allowed according to the terms of the BSD license.
19 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
22 IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
23 # In the cache already
24 SET(WAYLAND_FIND_QUIETLY TRUE)
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 wayland-cursor)
32 SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
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 FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
39 FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
40 FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
41 FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
42 FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
44 set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR})
46 set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES})
48 list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
50 include(FindPackageHandleStandardArgs)
52 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
53 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
54 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
55 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR)
56 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
59 WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
60 WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
61 WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
62 WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
63 WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES