summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-18 22:57:29 -0700
committerKeith Packard <keithp@keithp.com>2017-05-18 22:57:29 -0700
commitc059bd0735a9f3447becbbb84bab0ec3f1c89ebe (patch)
tree007b2831b4e3ee417376d2b87e0bddebeb00f5b4
parentc7ec1f439b79a49f25067a52cdc15c6540a6f5b0 (diff)
Add missing FindKMS.cmake fileHEADmaster
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--cmake/FindKMS.cmake33
1 files changed, 33 insertions, 0 deletions
diff --git a/cmake/FindKMS.cmake b/cmake/FindKMS.cmake
new file mode 100644
index 00000000..55679ad1
--- /dev/null
+++ b/cmake/FindKMS.cmake
@@ -0,0 +1,33 @@
+# - FindKMS
+#
+# Copyright © 2017 Keith Packard <keithp@keithp.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+
+# Use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+#
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PKG_KMS QUIET libdrm)
+
+SET(KMS_DEFINITIONS ${PKG_KMS_CFLAGS})
+
+FIND_PATH(KMS_TOP_INCLUDE_DIR NAMES xf86drm.h HINTS ${PKG_KMS_INCLUDE_DIRS})
+FIND_PATH(KMS_DRM_INCLUDE_DIR NAMES drm.h HINTS ${PKG_KMS_INCLUDE_DIRS})
+SET(KMS_INCLUDE_DIR ${KMS_TOP_INCLUDE_DIR} ${KMS_DRM_INCLUDE_DIR})
+FIND_LIBRARY(KMS_LIBRARIES NAMES drm HINTS ${PKG_KMS_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(KMS DEFAULT_MSG KMS_LIBRARIES KMS_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(KMS_INCLUDE_DIR KMS_LIBRARIES)
+