summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindGLX.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindGLX.cmake')
-rw-r--r--cmake/modules/FindGLX.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmake/modules/FindGLX.cmake b/cmake/modules/FindGLX.cmake
new file mode 100644
index 0000000..066cbb8
--- /dev/null
+++ b/cmake/modules/FindGLX.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# FindGLX
+# -----
+# Finds the GLX library
+#
+# This will define the following variables::
+#
+# GLX_FOUND - system has GLX
+# GLX_INCLUDE_DIRS - the GLX include directory
+# GLX_LIBRARIES - the GLX libraries
+# GLX_DEFINITIONS - the GLX definitions
+#
+# and the following imported targets::
+#
+# GLX::GLX - The GLX library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GLX glx QUIET)
+endif()
+
+find_path(GLX_INCLUDE_DIR NAMES GL/glx.h
+ PATHS ${PC_GLX_INCLUDEDIR})
+find_library(GLX_LIBRARY NAMES GL
+ PATHS ${PC_GLX_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLX
+ REQUIRED_VARS GLX_LIBRARY GLX_INCLUDE_DIR)
+
+if(GLX_FOUND)
+ set(GLX_LIBRARIES ${GLX_LIBRARY})
+ set(GLX_INCLUDE_DIRS ${GLX_INCLUDE_DIR})
+ set(GLX_DEFINITIONS -DHAS_GLX=1)
+endif()
+
+mark_as_advanced(GLX_INCLUDE_DIR GLX_LIBRARY)