summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindMicroHttpd.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindMicroHttpd.cmake')
-rw-r--r--cmake/modules/FindMicroHttpd.cmake51
1 files changed, 51 insertions, 0 deletions
diff --git a/cmake/modules/FindMicroHttpd.cmake b/cmake/modules/FindMicroHttpd.cmake
new file mode 100644
index 0000000..8eecbc4
--- /dev/null
+++ b/cmake/modules/FindMicroHttpd.cmake
@@ -0,0 +1,51 @@
1#.rst:
2# FindMicroHttpd
3# --------------
4# Finds the MicroHttpd library
5#
6# This will will define the following variables::
7#
8# MICROHTTPD_FOUND - system has MicroHttpd
9# MICROHTTPD_INCLUDE_DIRS - the MicroHttpd include directory
10# MICROHTTPD_LIBRARIES - the MicroHttpd libraries
11# MICROHTTPD_DEFINITIONS - the MicroHttpd definitions
12#
13# and the following imported targets::
14#
15# MicroHttpd::MicroHttpd - The MicroHttpd library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.4 QUIET)
19endif()
20
21find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h
22 PATHS ${PC_MICROHTTPD_INCLUDEDIR})
23find_library(MICROHTTPD_LIBRARY NAMES microhttpd libmicrohttpd
24 PATHS ${PC_MICROHTTPD_LIBDIR})
25
26set(MICROHTTPD_VERSION ${PC_MICROHTTPD_VERSION})
27
28include(FindPackageHandleStandardArgs)
29find_package_handle_standard_args(MicroHttpd
30 REQUIRED_VARS MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR
31 VERSION_VAR MICROHTTPD_VERSION)
32
33if(MICROHTTPD_FOUND)
34 set(MICROHTTPD_LIBRARIES ${MICROHTTPD_LIBRARY})
35 set(MICROHTTPD_INCLUDE_DIRS ${MICROHTTPD_INCLUDE_DIR})
36 set(MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1)
37
38 if(KODI_DEPENDSBUILD AND NOT WIN32)
39 find_library(GCRYPT_LIBRARY gcrypt)
40 find_library(GPGERROR_LIBRARY gpg-error)
41 list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY})
42 mark_as_advanced(GCRYPT_LIBRARY GPGERROR_LIBRARY)
43 if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android)
44 list(APPEND MICROHTTPD_LIBRARIES rt)
45 endif()
46 else()
47 list(APPEND MICROHTTPD_LIBRARIES ${PC_MICROHTTPD_STATIC_LIBRARIES})
48 endif()
49endif()
50
51mark_as_advanced(MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)