summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindWaylandProtocols.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindWaylandProtocols.cmake')
-rw-r--r--cmake/modules/FindWaylandProtocols.cmake24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmake/modules/FindWaylandProtocols.cmake b/cmake/modules/FindWaylandProtocols.cmake
new file mode 100644
index 0000000..e74bb80
--- /dev/null
+++ b/cmake/modules/FindWaylandProtocols.cmake
@@ -0,0 +1,24 @@
+# FindWaylandProtocols
+# --------------------
+# Find wayland-protocols
+#
+# This will define the following variables::
+#
+# WAYLAND_PROTOCOLS_DIR - directory containing the additional Wayland protocols
+# from the wayland-protocols package
+
+pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols)
+if(PC_WAYLAND_PROTOCOLS_FOUND)
+ pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+endif()
+
+# Promote to cache variables so all code can access it
+set(WAYLAND_PROTOCOLS_DIR ${WAYLAND_PROTOCOLS_DIR} CACHE INTERNAL "")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WaylandProtocols
+ REQUIRED_VARS
+ PC_WAYLAND_PROTOCOLS_FOUND
+ WAYLAND_PROTOCOLS_DIR
+ VERSION_VAR
+ PC_WAYLAND_PROTOCOLS_VERSION)