aboutsummaryrefslogtreecommitdiff
path: root/find-modules
diff options
context:
space:
mode:
authorVlad Zahorodnii <vlad.zahorodnii@kde.org>2020-08-26 14:41:43 +0300
committerVlad Zahorodnii <vlad.zahorodnii@kde.org>2020-08-27 09:43:10 +0300
commit39e46867e243b2b0e04c7f2b4269daf7f6c58a12 (patch)
treee00bf3e7358a1bb20f9a33f727734bc7722a584a /find-modules
parent17d053b86054e3bf75d5d299534e3efe6290ae92 (diff)
downloadextra-cmake-modules-39e46867e243b2b0e04c7f2b4269daf7f6c58a12.tar.gz
extra-cmake-modules-39e46867e243b2b0e04c7f2b4269daf7f6c58a12.tar.bz2
Add WaylandProtocols find module
An intended use case is to generate client-side and server-side code for protocols shipped in the wayland-protocols package with qtwaylandscanner.
Diffstat (limited to 'find-modules')
-rw-r--r--find-modules/FindWaylandProtocols.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/find-modules/FindWaylandProtocols.cmake b/find-modules/FindWaylandProtocols.cmake
new file mode 100644
index 00000000..b314cadd
--- /dev/null
+++ b/find-modules/FindWaylandProtocols.cmake
@@ -0,0 +1,39 @@
+#.rst:
+# FindWaylandProtocols
+# --------------------
+#
+# Try to find wayland-protocols on a Unix system.
+#
+# This will define the following variables:
+#
+# ``WaylandProtocols_FOUND``
+# True if (the requested version of) wayland-protocols is available
+# ``WaylandProtocols_VERSION``
+# The version of wayland-protocols
+# ``WaylandProtocols_DATADIR``
+# The wayland protocols data directory
+
+#=============================================================================
+# SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#=============================================================================
+
+find_package(PkgConfig)
+pkg_check_modules(PKG_wayland_protocols QUIET wayland-protocols)
+
+set(WaylandProtocols_VERSION ${PKG_wayland_protocols_VERSION})
+pkg_get_variable(WaylandProtocols_DATADIR wayland-protocols pkgdatadir)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WaylandProtocols
+ FOUND_VAR WaylandProtocols_FOUND
+ REQUIRED_VARS WaylandProtocols_DATADIR
+ VERSION_VAR WaylandProtocols_VERSION
+)
+
+include(FeatureSummary)
+set_package_properties(WaylandProtocols PROPERTIES
+ DESCRIPTION "Specifications of extended Wayland protocols"
+ URL "https://wayland.freedesktop.org/"
+)