aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindLibDisplayInfo.cmake
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2023-04-14 17:59:18 -0700
committerGitHub <noreply@github.com>2023-04-14 17:59:18 -0700
commita3e7d1a9b0f3da68f1571eb3981e74920f536a2f (patch)
treeaf938018434bf9a841e5de5e94e8097b8b2b9f98 /cmake/modules/FindLibDisplayInfo.cmake
parent915d0ecbbe1a74a2cd2acba8856f825770b512bd (diff)
parent2cf5b86a1f4ad777115f169cfa361d09ffe80ce2 (diff)
Merge pull request #19141 from lrusak/edid-decode
Diffstat (limited to 'cmake/modules/FindLibDisplayInfo.cmake')
-rw-r--r--cmake/modules/FindLibDisplayInfo.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmake/modules/FindLibDisplayInfo.cmake b/cmake/modules/FindLibDisplayInfo.cmake
new file mode 100644
index 0000000000..add628d8c7
--- /dev/null
+++ b/cmake/modules/FindLibDisplayInfo.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# FindLibDisplayInfo
+# -------
+# Finds the libdisplay-info library
+#
+# This will define the following variables::
+#
+# LIBDISPLAYINFO_FOUND - system has LIBDISPLAY-INFO
+# LIBDISPLAYINFO_INCLUDE_DIRS - the LIBDISPLAY-INFO include directory
+# LIBDISPLAYINFO_LIBRARIES - the LIBDISPLAY-INFO libraries
+# LIBDISPLAYINFO_DEFINITIONS - the LIBDISPLAY-INFO definitions
+#
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBDISPLAYINFO libdisplay-info QUIET)
+endif()
+
+find_path(LIBDISPLAYINFO_INCLUDE_DIR libdisplay-info/edid.h
+ PATHS ${PC_LIBDISPLAYINFO_INCLUDEDIR})
+
+find_library(LIBDISPLAYINFO_LIBRARY NAMES display-info
+ PATHS ${PC_LIBDISPLAYINFO_LIBDIR})
+
+set(LIBDISPLAYINFO_VERSION ${PC_LIBDISPLAYINFO_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDisplayInfo
+ REQUIRED_VARS LIBDISPLAYINFO_LIBRARY LIBDISPLAYINFO_INCLUDE_DIR
+ VERSION_VAR LIBDISPLAYINFO_VERSION)
+
+if(LIBDISPLAYINFO_FOUND)
+ set(LIBDISPLAYINFO_LIBRARIES ${LIBDISPLAYINFO_LIBRARY})
+ set(LIBDISPLAYINFO_INCLUDE_DIRS ${LIBDISPLAYINFO_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBDISPLAYINFO_INCLUDE_DIR LIBDISPLAYINFO_LIBRARY)