diff options
author | Keith Packard <keithp@keithp.com> | 2017-05-18 22:57:29 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-05-18 22:57:29 -0700 |
commit | c059bd0735a9f3447becbbb84bab0ec3f1c89ebe (patch) | |
tree | 007b2831b4e3ee417376d2b87e0bddebeb00f5b4 | |
parent | c7ec1f439b79a49f25067a52cdc15c6540a6f5b0 (diff) |
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | cmake/FindKMS.cmake | 33 |
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) + |