aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindEGL.cmake
diff options
context:
space:
mode:
authorh.udo <hudokkow@gmail.com>2016-09-08 18:15:54 +0100
committerh.udo <hudokkow@gmail.com>2016-12-21 10:04:18 +0000
commita18701e7b2fe03780f90502d5d51e09cdc3ad718 (patch)
treea9d2c2cca8599a18a78c6b1345f42e48e76ddb27 /cmake/modules/FindEGL.cmake
parentf2b31fda391d3364b7307ab9f9216fa0ee7164c7 (diff)
[cmake] Move to root folder: Move files
Diffstat (limited to 'cmake/modules/FindEGL.cmake')
-rw-r--r--cmake/modules/FindEGL.cmake48
1 files changed, 48 insertions, 0 deletions
diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake
new file mode 100644
index 0000000000..79bb176fe8
--- /dev/null
+++ b/cmake/modules/FindEGL.cmake
@@ -0,0 +1,48 @@
+#.rst:
+# FindEGL
+# -------
+# Finds the EGL library
+#
+# This will will define the following variables::
+#
+# EGL_FOUND - system has EGL
+# EGL_INCLUDE_DIRS - the EGL include directory
+# EGL_LIBRARIES - the EGL libraries
+# EGL_DEFINITIONS - the EGL definitions
+#
+# and the following imported targets::
+#
+# EGL::EGL - The EGL library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_EGL egl QUIET)
+endif()
+
+find_path(EGL_INCLUDE_DIR EGL/egl.h
+ PATHS ${PC_EGL_INCLUDEDIR})
+
+find_library(EGL_LIBRARY NAMES EGL egl
+ PATHS ${PC_EGL_LIBDIR})
+
+set(EGL_VERSION ${PC_EGL_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EGL
+ REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR
+ VERSION_VAR EGL_VERSION)
+
+if(EGL_FOUND)
+ set(EGL_LIBRARIES ${EGL_LIBRARY})
+ set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
+ set(EGL_DEFINITIONS -DHAVE_LIBEGL=1)
+
+ if(NOT TARGET EGL::EGL)
+ add_library(EGL::EGL UNKNOWN IMPORTED)
+ set_target_properties(EGL::EGL PROPERTIES
+ IMPORTED_LOCATION "${EGL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1)
+ endif()
+endif()
+
+mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)