blob: f73dc774171c452dae0d08eae610f79d78487966 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
IF (NOT WIN32)
include(FindPkgConfig)
if ( PKG_CONFIG_FOUND )
pkg_check_modules (MICROHTTPD libmicrohttpd>=0.4)
set(MICROHTTPD_DEFINITIONS ${MICROHTTPD_CFLAGS_OTHER})
endif(PKG_CONFIG_FOUND)
endif (NOT WIN32)
#
# set defaults
if(NOT MICROHTTPD_FOUND)
SET(_microhttpd_HOME "/usr/local")
SET(_microhttpd_INCLUDE_SEARCH_DIRS
${CMAKE_INCLUDE_PATH}
/usr/local/include
/usr/include
)
SET(_microhttpd_LIBRARIES_SEARCH_DIRS
${CMAKE_LIBRARY_PATH}
/usr/local/lib
/usr/lib
)
##
if( "${MICROHTTPD_HOME}" STREQUAL "")
if("" MATCHES "$ENV{MICROHTTPD_HOME}")
message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local")
set (MICROHTTPD_HOME ${_microhttpd_HOME})
else("" MATCHES "$ENV{MICROHTTPD_HOME}")
set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}")
endif("" MATCHES "$ENV{MICROHTTPD_HOME}")
else( "${MICROHTTPD_HOME}" STREQUAL "")
message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"")
endif( "${MICROHTTPD_HOME}" STREQUAL "")
##
message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}")
IF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
SET(_microhttpd_HOME ${MICROHTTPD_HOME})
ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS})
ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS})
ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
IF( MICROHTTPD_HOME )
SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
SET(_microhttpd_HOME ${MICROHTTPD_HOME})
ENDIF( MICROHTTPD_HOME )
# find the include files
FIND_PATH(MICROHTTPD_INCLUDE_DIRS microhttpd.h
HINTS
${_microhttpd_INCLUDE_SEARCH_DIRS}
${PC_MICROHTTPD_INCLUDEDIR}
${PC_MICROHTTPD_INCLUDE_DIRS}
${CMAKE_INCLUDE_PATH}
)
# locate the library
IF(WIN32)
SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.lib)
ELSE(WIN32)
SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a)
ENDIF(WIN32)
FIND_LIBRARY(MICROHTTPD_LIBRARIES NAMES ${MICROHTTPD_LIBRARY_NAMES}
HINTS
${_microhttpd_LIBRARIES_SEARCH_DIRS}
${PC_MICROHTTPD_LIBDIR}
${PC_MICROHTTPD_LIBRARY_DIRS}
)
# if the include and the program are found then we have it
IF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES)
SET(MICROHTTPD_FOUND "YES")
ENDIF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES)
if( NOT WIN32)
find_library(GCRYPT_LIBRARY gcrypt)
find_library(GPGERROR_LIBRARY gpg-error)
list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY})
if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android)
list(APPEND MICROHTTPD_LIBRARIES "-lrt")
endif()
endif( NOT WIN32)
endif()
list(APPEND MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1)
MARK_AS_ADVANCED(
MICROHTTPD_FOUND
MICROHTTPD_LIBRARIES
MICROHTTPD_DEFINITIONS
MICROHTTPD_INCLUDE_DIRS
)
|