summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindXRandR.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /cmake/modules/FindXRandR.cmake
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindXRandR.cmake')
-rw-r--r--cmake/modules/FindXRandR.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/cmake/modules/FindXRandR.cmake b/cmake/modules/FindXRandR.cmake
new file mode 100644
index 0000000..12f3478
--- /dev/null
+++ b/cmake/modules/FindXRandR.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindXRandR
+# ----------
+# Finds the XRandR library
+#
+# This will define the following variables::
+#
+# XRANDR_FOUND - system has XRANDR
+# XRANDR_INCLUDE_DIRS - the XRANDR include directory
+# XRANDR_LIBRARIES - the XRANDR libraries
+# XRANDR_DEFINITIONS - the XRANDR definitions
+#
+# and the following imported targets::
+#
+# XRandR::XRandR - The XRANDR library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_XRANDR xrandr QUIET)
+endif()
+
+find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
+ PATHS ${PC_XRANDR_INCLUDEDIR})
+find_library(XRANDR_LIBRARY NAMES Xrandr
+ PATHS ${PC_XRANDR_LIBDIR})
+
+set(XRANDR_VERSION ${PC_XRANDR_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XRandR
+ REQUIRED_VARS XRANDR_LIBRARY XRANDR_INCLUDE_DIR
+ VERSION_VAR XRANDR_VERSION)
+
+if(XRANDR_FOUND)
+ set(XRANDR_LIBRARIES ${XRANDR_LIBRARY})
+ set(XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR})
+ set(XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1)
+
+ if(NOT TARGET XRandR::XRandR)
+ add_library(XRandR::XRandR UNKNOWN IMPORTED)
+ set_target_properties(XRandR::XRandR PROPERTIES
+ IMPORTED_LOCATION "${XRANDR_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XRANDR_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBXRANDR=1)
+ endif()
+endif()
+
+mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY)