Merge pull request #23092 from webosbrew/feature/webOS
[xbmc.git] / cmake / modules / FindMicroHttpd.cmake
bloba0b91a00857f570cfff5249a8f3f2d8cb1130913
1 #.rst:
2 # FindMicroHttpd
3 # --------------
4 # Finds the MicroHttpd library
6 # This will define the following variables::
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
13 # and the following imported targets::
15 #   MicroHttpd::MicroHttpd   - The MicroHttpd library
17 if(PKG_CONFIG_FOUND)
18   pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.9.40 QUIET)
19 endif()
21 find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h
22                                  PATHS ${PC_MICROHTTPD_INCLUDEDIR})
23 find_library(MICROHTTPD_LIBRARY NAMES microhttpd libmicrohttpd
24                                 PATHS ${PC_MICROHTTPD_LIBDIR})
26 set(MICROHTTPD_VERSION ${PC_MICROHTTPD_VERSION})
28 include(FindPackageHandleStandardArgs)
29 find_package_handle_standard_args(MicroHttpd
30                                   REQUIRED_VARS MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR
31                                   VERSION_VAR MICROHTTPD_VERSION)
33 if(MICROHTTPD_FOUND)
34   set(MICROHTTPD_LIBRARIES ${MICROHTTPD_LIBRARY})
35   set(MICROHTTPD_INCLUDE_DIRS ${MICROHTTPD_INCLUDE_DIR})
36   set(MICROHTTPD_DEFINITIONS -DHAS_WEB_SERVER=1 -DHAS_WEB_INTERFACE=1)
38   if(${MICROHTTPD_LIBRARY} MATCHES ".+\.a$" AND PC_MICROHTTPD_STATIC_LIBRARIES)
39     list(APPEND MICROHTTPD_LIBRARIES ${PC_MICROHTTPD_STATIC_LIBRARIES})
40   endif()
41 endif()
43 mark_as_advanced(MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)