summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindMicroHttpd.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/FindMicroHttpd.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/FindMicroHttpd.cmake')
-rw-r--r--cmake/modules/FindMicroHttpd.cmake43
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake/modules/FindMicroHttpd.cmake b/cmake/modules/FindMicroHttpd.cmake
new file mode 100644
index 0000000..a0b91a0
--- /dev/null
+++ b/cmake/modules/FindMicroHttpd.cmake
@@ -0,0 +1,43 @@
+#.rst:
+# FindMicroHttpd
+# --------------
+# Finds the MicroHttpd library
+#
+# This will define the following variables::
+#
+# MICROHTTPD_FOUND - system has MicroHttpd
+# MICROHTTPD_INCLUDE_DIRS - the MicroHttpd include directory
+# MICROHTTPD_LIBRARIES - the MicroHttpd libraries
+# MICROHTTPD_DEFINITIONS - the MicroHttpd definitions
+#
+# and the following imported targets::
+#
+# MicroHttpd::MicroHttpd - The MicroHttpd library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.9.40 QUIET)
+endif()
+
+find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h
+ PATHS ${PC_MICROHTTPD_INCLUDEDIR})
+find_library(MICROHTTPD_LIBRARY NAMES microhttpd libmicrohttpd
+ PATHS ${PC_MICROHTTPD_LIBDIR})
+
+set(MICROHTTPD_VERSION ${PC_MICROHTTPD_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MicroHttpd
+ REQUIRED_VARS MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR
+ VERSION_VAR MICROHTTPD_VERSION)
+
+if(MICROHTTPD_FOUND)
+ set(MICROHTTPD_LIBRARIES ${MICROHTTPD_LIBRARY})
+ set(MICROHTTPD_INCLUDE_DIRS ${MICROHTTPD_INCLUDE_DIR})
+ set(MICROHTTPD_DEFINITIONS -DHAS_WEB_SERVER=1 -DHAS_WEB_INTERFACE=1)
+
+ if(${MICROHTTPD_LIBRARY} MATCHES ".+\.a$" AND PC_MICROHTTPD_STATIC_LIBRARIES)
+ list(APPEND MICROHTTPD_LIBRARIES ${PC_MICROHTTPD_STATIC_LIBRARIES})
+ endif()
+endif()
+
+mark_as_advanced(MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)