Mun Gwan-gyeong | 81292d9 | 2016-06-27 05:34:44 +0900 | [diff] [blame^] | 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 | |
| 21 | IF (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 wayland-cursor) |
| 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 | FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) |
| 38 | |
| 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}) |
| 43 | |
| 44 | set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR}) |
| 45 | |
| 46 | set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) |
| 47 | |
| 48 | list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) |
| 49 | |
| 50 | include(FindPackageHandleStandardArgs) |
| 51 | |
| 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) |
| 57 | |
| 58 | MARK_AS_ADVANCED( |
| 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 |
| 64 | ) |
| 65 | |
| 66 | ENDIF () |