summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindWaylandpp.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindWaylandpp.cmake')
-rw-r--r--cmake/modules/FindWaylandpp.cmake64
1 files changed, 64 insertions, 0 deletions
diff --git a/cmake/modules/FindWaylandpp.cmake b/cmake/modules/FindWaylandpp.cmake
new file mode 100644
index 0000000..8a1cd74
--- /dev/null
+++ b/cmake/modules/FindWaylandpp.cmake
@@ -0,0 +1,64 @@
1# FindWaylandpp
2# -----------
3# Finds the waylandpp library
4#
5# This will will define the following variables::
6#
7# WAYLANDPP_FOUND - the system has Wayland
8# WAYLANDPP_INCLUDE_DIRS - the Wayland include directory
9# WAYLANDPP_LIBRARIES - the Wayland libraries
10# WAYLANDPP_DEFINITIONS - the Wayland definitions
11
12
13if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_WAYLANDPP wayland-client++>=0.1 wayland-egl++ wayland-cursor++ wayland-scanner++ QUIET)
15 pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols>=1.7 QUIET)
16 # TODO: Remove check when CMake minimum version is bumped globally
17 if(CMAKE_VERSION VERSION_EQUAL 3.4.0 OR CMAKE_VERSION VERSION_GREATER 3.4.0)
18 if(PC_WAYLANDPP_FOUND)
19 pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp)
20 endif()
21 if(PC_WAYLAND_PROTOCOLS_FOUND)
22 pkg_get_variable(PC_WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
23 endif()
24 endif()
25endif()
26
27find_path(WAYLANDPP_INCLUDE_DIR NAMES wayland-client.hpp
28 PATHS ${PC_WAYLANDPP_INCLUDE_DIRS})
29
30find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++
31 PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS})
32
33find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++
34 PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS})
35
36find_library(WAYLANDPP_EGL_LIBRARY NAMES wayland-egl++
37 PATHS ${PC_WAYLANDPP_LIBRARIES} ${PC_WAYLANDPP_LIBRARY_DIRS})
38
39find_program(WAYLANDPP_SCANNER NAMES wayland-scanner++
40 PATHS ${PC_WAYLANDPP_SCANNER})
41
42find_path(WAYLAND_PROTOCOLS_DIR NAMES unstable/xdg-shell/xdg-shell-unstable-v6.xml
43 PATHS ${PC_WAYLAND_PROTOCOLS_DIR}
44 DOC "Directory containing additional Wayland protocols")
45
46include (FindPackageHandleStandardArgs)
47find_package_handle_standard_args (Waylandpp
48 REQUIRED_VARS
49 WAYLANDPP_INCLUDE_DIR
50 WAYLANDPP_CLIENT_LIBRARY
51 WAYLANDPP_CURSOR_LIBRARY
52 WAYLANDPP_EGL_LIBRARY
53 WAYLANDPP_SCANNER
54 WAYLAND_PROTOCOLS_DIR
55 VERSION_VAR
56 PC_WAYLANDPP_wayland-client++_VERSION)
57
58if (WAYLANDPP_FOUND)
59 set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY} ${WAYLANDPP_CURSOR_LIBRARY} ${WAYLANDPP_EGL_LIBRARY})
60 set(WAYLANDPP_INCLUDE_DIRS ${PC_WAYLANDPP_INCLUDE_DIRS})
61 set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1)
62endif()
63
64mark_as_advanced (WAYLANDPP_CLIENT_LIBRARY WAYLANDPP_CURSOR_LIBRARY WAYLANDPP_EGL_LIBRARY WAYLANDPP_INCLUDE_DIR)