Backported #6865: Disable websockets command line option
[platform/upstream/freerdp.git] / cmake / FindWayland.cmake
1 # - Finds Wayland
2 # Find the Wayland libraries that are needed for UWAC
3 #
4 #  This module defines the following variables:
5 #     WAYLAND_FOUND     - true if UWAC has been found
6 #     WAYLAND_LIBS      - Set to the full path to wayland client libraries
7 #     WAYLAND_INCLUDE_DIR - Set to the include directories for wayland
8 #     XKBCOMMON_LIBS      - Set to the full path to xkbcommon libraries
9 #     XKBCOMMON_INCLUDE_DIR - Set to the include directories for xkbcommon
10 #
11
12 #=============================================================================
13 # Copyright 2015 David Fort <contact@hardening-consulting.com>
14 #
15 # Licensed under the Apache License, Version 2.0 (the "License");
16 # you may not use this file except in compliance with the License.
17 # You may obtain a copy of the License at
18 #
19 #     http://www.apache.org/licenses/LICENSE-2.0
20 #
21 # Unless required by applicable law or agreed to in writing, software
22 # distributed under the License is distributed on an "AS IS" BASIS,
23 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 # See the License for the specific language governing permissions and
25 # limitations under the License.
26 #=============================================================================
27
28 include(FindPkgConfig)
29
30 if(PKG_CONFIG_FOUND)
31     pkg_check_modules(WAYLAND_SCANNER_PC wayland-scanner)
32     pkg_check_modules(WAYLAND_CLIENT_PC wayland-client)
33                 pkg_check_modules(WAYLAND_CURSOR_PC wayland-cursor)
34     pkg_check_modules(XKBCOMMON_PC xkbcommon)
35 endif()
36
37 find_program(WAYLAND_SCANNER wayland-scanner
38     HINTS "${WAYLAND_SCANNER_PC_PREFIX}/bin"
39 )
40
41 find_path(WAYLAND_INCLUDE_DIR wayland-client.h
42     HINTS ${WAYLAND_CLIENT_PC_INCLUDE_DIRS}
43 )
44
45 find_library(WAYLAND_CLIENT_LIB
46     NAMES "wayland-client"
47     HINTS "${WAYLAND_CLIENT_PC_LIBRARY_DIRS}"
48 )
49
50 find_library(WAYLAND_CURSOR_LIB
51     NAMES "wayland-cursor"
52                 HINTS "${WAYLAND_CURSOR_PC_LIBRARY_DIRS}"
53 )
54
55 if (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
56         list(APPEND WAYLAND_LIBS ${WAYLAND_CLIENT_LIB} ${WAYLAND_CURSOR_LIB})
57 endif (WAYLAND_CLIENT_LIB AND WAYLAND_CURSOR_LIB)
58
59 find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h
60     HINTS ${XKBCOMMON_PC_INCLUDE_DIRS}
61 )
62
63 find_library(XKBCOMMON_LIBS
64     NAMES xkbcommon
65     HINTS "${XKBCOMMON_PC_LIBRARY_DIRS}"
66 )
67
68 include(FindPackageHandleStandardArgs)
69 FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_SCANNER WAYLAND_INCLUDE_DIR WAYLAND_LIBS XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBS)