[tests] skip mod-secdownload HMAC-SHA1,HMAC-SHA256
[lighttpd.git] / src / CMakeLists.txt
blob6026520f56831fe951eb0fbc873f139ce180a066
1 include(CheckCSourceCompiles)
2 include(CheckIncludeFiles)
3 include(CheckFunctionExists)
4 include(CheckSymbolExists)
5 include(CheckVariableExists)
6 include(CheckTypeSize)
7 include(CheckLibraryExists)
8 include(CMakeDetermineCCompiler)
9 include(FindThreads)
10 include(FindPkgConfig)
12 include(LighttpdMacros)
14 add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
16 option(WITH_XATTR "with xattr-support for the stat-cache [default: off]")
17 option(WITH_MYSQL "with mysql-support for mod_vhostdb_mysql [default: off]")
18 option(WITH_PGSQL "with postgres-support for mod_vhostdb_pgsql [default: off]")
19 option(WITH_DBI "with dbi-support for mod_vhostdb_dbi [default: off]")
20 option(WITH_OPENSSL "with openssl-support [default: off]")
21 option(WITH_WOLFSSL "with wolfSSL-support [default: off]")
22 option(WITH_PCRE "with regex support [default: on]" ON)
23 option(WITH_WEBDAV_PROPS "with property-support for mod_webdav [default: off]")
24 option(WITH_WEBDAV_LOCKS "locks in webdav [default: off]")
25 option(WITH_BZIP "with bzip2-support for mod_compress [default: off]")
26 option(WITH_ZLIB "with deflate-support for mod_compress [default: on]" ON)
27 option(WITH_KRB5 "with Kerberos5-support for mod_auth [default: off]")
28 option(WITH_LDAP "with LDAP-support for mod_auth mod_vhostdb_ldap [default: off]")
29 option(WITH_PAM "with PAM-support for mod_auth [default: off]")
30 option(WITH_LUA "with lua 5.1 for mod_magnet [default: off]")
31 # option(WITH_VALGRIND "with internal support for valgrind [default: off]")
32 option(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]")
33 option(WITH_GDBM "gdbm storage for mod_trigger_b4_dl [default: off]")
34 option(WITH_MEMCACHED "memcached storage for mod_trigger_b4_dl [default: off]")
35 option(WITH_LIBEV "libev support for fdevent handlers [default: off]")
36 option(WITH_LIBUNWIND "with libunwind to print backtraces in asserts [default: off]")
37 option(WITH_GEOIP "with GeoIP-support mod_geoip [default: off]")
38 option(WITH_SASL "with SASL-support for mod_authn_sasl [default: off]")
40 if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
41         option(BUILD_EXTRA_WARNINGS "extra warnings")
43         if(BUILD_EXTRA_WARNINGS)
44                 set(WARN_CFLAGS "-g -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security")
45                 set(WARN_LDFLAGS "-Wl,--as-needed")
46                 # -Werror -Wbad-function-cast -Wmissing-prototypes
47         endif()
48 endif()
50 option(BUILD_STATIC "build a static lighttpd with all modules added")
52 if(BUILD_STATIC)
53         set(LIGHTTPD_STATIC 1)
54 elseif(APPLE)
55         set(CMAKE_SHARED_MODULE_PREFIX "")
56 else()
57         set(CMAKE_SHARED_LIBRARY_PREFIX "")
58 endif()
60 if(WITH_LIBEV)
61         find_package(LibEV REQUIRED)
62         set(HAVE_LIBEV 1)
63 endif()
65 if(WITH_LIBUNWIND)
66         pkg_check_modules(LIBUNWIND REQUIRED libunwind)
67         set(HAVE_LIBUNWIND 1)
68 endif()
70 if(WITH_WEBDAV_PROPS)
71         set(WITH_XML 1)
72         set(WITH_SQLITE3 1)
73 endif()
75 if(WITH_WEBDAV_LOCKS)
76         set(WITH_UUID 1)
77 endif()
79 check_include_files(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
80 check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
81 set(CMAKE_REQUIRED_FLAGS "-include sys/types.h")
82 check_include_files(sys/event.h HAVE_SYS_EVENT_H)
83 set(CMAKE_REQUIRED_FLAGS)
84 check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
85 check_include_files(sys/poll.h HAVE_SYS_POLL_H)
86 check_include_files(sys/port.h HAVE_SYS_PORT_H)
87 check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
88 check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
89 check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
90 check_include_files(sys/select.h HAVE_SYS_SELECT_H)
91 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
92 check_include_files(sys/uio.h HAVE_SYS_UIO_H)
93 check_include_files(sys/un.h HAVE_SYS_UN_H)
94 check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
95 check_include_files(sys/time.h HAVE_SYS_TIME_H)
96 check_include_files(unistd.h HAVE_UNISTD_H)
97 check_include_files(pthread.h HAVE_PTHREAD_H)
98 check_include_files(getopt.h HAVE_GETOPT_H)
99 check_include_files(inttypes.h HAVE_INTTYPES_H)
100 check_include_files(poll.h HAVE_POLL_H)
101 check_include_files(pwd.h HAVE_PWD_H)
102 check_include_files(stddef.h HAVE_STDDEF_H)
103 check_include_files(stdint.h HAVE_STDINT_H)
104 check_include_files(strings.h HAVE_STRINGS_H)
105 check_include_files(syslog.h HAVE_SYSLOG_H)
107 # check for fastcgi lib, for the tests only
108 check_include_files(fastcgi.h HAVE_FASTCGI_H)
109 check_include_files(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H)
111 # will be needed for auth
112 check_include_files(crypt.h HAVE_CRYPT_H)
113 # check if we need libcrypt for crypt_r()
114 check_library_exists(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R)
115 if(HAVE_LIBCRYPT_CRYPT_R)
116         set(HAVE_CRYPT_R 1)
117         set(HAVE_LIBCRYPT 1)
118 else()
119         check_library_exists(crypt crypt "" HAVE_LIBCRYPT)
120 endif()
121 check_function_exists(crypt_r HAVE_CRYPT_R)
122 check_function_exists(crypt HAVE_CRYPT)
124 check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
125 if(HAVE_SYS_INOTIFY_H)
126         check_function_exists(inotify_init HAVE_INOTIFY_INIT)
127 endif()
129 set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
130 check_type_size(socklen_t HAVE_SOCKLEN_T)
131 set(CMAKE_EXTRA_INCLUDE_FILES)
133 check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
134 set(CMAKE_EXTRA_INCLUDE_FILES sys/random.h)
135 check_function_exists(getentropy HAVE_GETENTROPY)
136 set(CMAKE_EXTRA_INCLUDE_FILES)
138 check_include_files(linux/random.h HAVE_LINUX_RANDOM_H)
139 set(CMAKE_EXTRA_INCLUDE_FILES linux/random.h)
140 check_function_exists(getrandom HAVE_GETRANDOM)
141 set(CMAKE_EXTRA_INCLUDE_FILES)
143 check_type_size(long SIZEOF_LONG)
144 check_type_size(off_t SIZEOF_OFF_T)
146 check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF)
147 check_function_exists(chroot HAVE_CHROOT)
148 check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
149 check_function_exists(fork HAVE_FORK)
150 check_function_exists(getloadavg HAVE_GETLOADAVG)
151 check_function_exists(getrlimit HAVE_GETRLIMIT)
152 check_function_exists(getuid HAVE_GETUID)
153 check_function_exists(gmtime_r HAVE_GMTIME_R)
154 check_function_exists(inet_ntop HAVE_INET_NTOP)
155 check_function_exists(jrand48 HAVE_JRAND48)
156 check_function_exists(kqueue HAVE_KQUEUE)
157 check_function_exists(localtime_r HAVE_LOCALTIME_R)
158 check_function_exists(lstat HAVE_LSTAT)
159 check_function_exists(madvise HAVE_MADVISE)
160 check_function_exists(memcpy HAVE_MEMCPY)
161 check_function_exists(memset HAVE_MEMSET)
162 check_function_exists(mmap HAVE_MMAP)
163 check_function_exists(pathconf HAVE_PATHCONF)
164 check_function_exists(pipe2 HAVE_PIPE2)
165 check_function_exists(poll HAVE_POLL)
166 check_function_exists(port_create HAVE_PORT_CREATE)
167 check_function_exists(prctl HAVE_PRCTL)
168 check_function_exists(pread HAVE_PREAD)
169 check_function_exists(posix_fadvise HAVE_POSIX_FADVISE)
170 check_function_exists(select HAVE_SELECT)
171 check_function_exists(sendfile HAVE_SENDFILE)
172 check_function_exists(send_file HAVE_SEND_FILE)
173 check_function_exists(sendfile64 HAVE_SENDFILE64)
174 check_function_exists(sendfilev HAVE_SENDFILEV)
175 check_function_exists(sigaction HAVE_SIGACTION)
176 check_function_exists(signal HAVE_SIGNAL)
177 check_function_exists(sigtimedwait HAVE_SIGTIMEDWAIT)
178 check_function_exists(srandom HAVE_SRANDOM)
179 check_function_exists(strptime HAVE_STRPTIME)
180 check_function_exists(syslog HAVE_SYSLOG)
181 check_function_exists(writev HAVE_WRITEV)
182 check_function_exists(inet_aton HAVE_INET_ATON)
183 check_function_exists(issetugid HAVE_ISSETUGID)
184 check_function_exists(inet_pton HAVE_INET_PTON)
185 check_function_exists(memset_s HAVE_MEMSET_S)
186 check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
187 check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
188 if (NOT HAVE_CLOCK_GETTIME)
189         check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
190 endif()
191 check_library_exists(elftc elftc_copyfile "libelftc.h" HAVE_ELFTC_COPYFILE)
192 check_c_source_compiles("
193         #include <sys/types.h>
194         #include <sys/socket.h>
195         #include <netinet/in.h>
197         int main() {
198                 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
199                 return 0;
200         }" HAVE_IPV6)
201 check_c_source_compiles("
202         __attribute__((weak)) void __dummy(void *x) { }
203         int main() {
204                 void *x;
205                 __dummy(x);
206         }
207         " HAVE_WEAK_SYMBOLS)
208 check_c_source_compiles("
209         #include <time.h>
210         int main(void) {
211                 struct tm t;
212                 t.tm_gmtoff = 0;
213                 return 0;
214         }
215         " HAVE_STRUCT_TM_GMTOFF)
217 ## refactor me
218 macro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
219 # reset the variables at the beginning
220         set(${_include_DIR})
221         set(${_link_DIR})
222         set(${_link_FLAGS})
223         set(${_cflags})
225         find_program(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin )
227         # if pkg-config has been found
228         if(${_package}CONFIG_EXECUTABLE)
229                 set(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}")
230                 message(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}")
232                 exec_program(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS)
233                 string(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS})
234                 exec_program(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags)
235                 string(REPLACE "\n" "" ${_cflags} ${__cflags})
236         else()
237                 message(STATUS "found ${_package}: no")
238         endif()
239 endmacro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
241 if(WITH_XATTR)
242         check_include_files("sys/types.h;attr/attributes.h" HAVE_ATTR_ATTRIBUTES_H)
243         if(HAVE_ATTR_ATTRIBUTES_H)
244                 check_library_exists(attr attr_get "" HAVE_XATTR)
245         endif()
246 else()
247         unset(HAVE_ATTR_ATTRIBUTES_H)
248         unset(HAVE_XATTR)
249 endif()
251 if(WITH_MYSQL)
252         xconfig(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS)
254         set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql)
255         check_include_files(mysql.h HAVE_MYSQL_H)
256         set(CMAKE_REQUIRED_INCLUDES)
257         if(HAVE_MYSQL_H)
258                 check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL)
259         endif()
260 else()
261         unset(HAVE_MYSQL_H)
262         unset(HAVE_MYSQL)
263 endif()
265 if(WITH_PGSQL)
266         xconfig(pg_config PGSQL_INCDIR PGSQL_LIBDIR PGSQL_LDFLAGS PGSQL_CFLAGS)
268         check_include_files(libpq-fe.h HAVE_PGSQL_H)
269         if(HAVE_PGSQL_H)
270                 check_library_exists(pq PQsetdbLogin "" HAVE_PGSQL)
271         endif()
272 else()
273         unset(HAVE_PGSQL_H)
274         unset(HAVE_PGSQL)
275 endif()
277 if(WITH_DBI)
278         check_include_files(dbi/dbi.h HAVE_DBI_H)
279         if(HAVE_DBI_H)
280                 check_library_exists(dbi dbi_conn_connect "" HAVE_DBI)
281         endif()
282 else()
283         unset(HAVE_DBI_H)
284         unset(HAVE_DBI)
285 endif()
287 set(CRYPTO_LIBRARY "")
289 if(WITH_OPENSSL)
290         if(APPLE)
291                 set(CMAKE_REQUIRED_INCLUDES /opt/local/include)
292         endif()
293         check_include_files(openssl/ssl.h HAVE_OPENSSL_SSL_H)
294         if(APPLE)
295                 set(CMAKE_REQUIRED_INCLUDES)
296         endif()
297         if(HAVE_OPENSSL_SSL_H)
298                 check_library_exists(crypto BIO_f_base64 "" HAVE_LIBCRYPTO)
299                 if(HAVE_LIBCRYPTO)
300                         set(CRYPTO_LIBRARY crypto)
301                         check_library_exists(ssl SSL_new "" HAVE_LIBSSL)
302                 endif()
303         endif()
304 else()
305         unset(HAVE_OPENSSL_SSL_H)
306         unset(HAVE_LIBSSL)
307 endif()
309 if(WITH_WOLFSSL)
310         if(NOT ${WITH_WOLFSSL} EQUAL "")
311                 find_path(WOLFSSL_INCLUDE_DIR wolfssl/ssl.h ${WITH_WOLFSSL}/include)
312         elseif(APPLE)
313                 find_path(WOLFSSL_INCLUDE_DIR wolfssl/ssl.h /opt/local/include)
314         else()
315                 find_path(WOLFSSL_INCLUDE_DIR wolfssl/ssl.h /usr/local/include)
316         endif()
318         if(NOT ${WITH_WOLFSSL} EQUAL "")
319                 find_library(WOLFSSL_LIBRARY
320                         NAMES wolfssl
321                         PATHS ${WITH_WOLFSSL}/lib
322                 )
323         else()
324                 find_library(WOLFSSL_LIBRARY
325                         NAMES wolfssl
326                         PATHS /usr/local/lib /opt/local/lib /usr/lib
327                 )
328         endif()
330         if(WOLFSSL_INCLUDE_DIR AND WOLFSSL_LIBRARY)
331                 set(CMAKE_REQUIRED_INCLUDES ${WOLFSSL_INCLUDE_DIR})
332                 check_include_files(wolfssl/ssl.h HAVE_WOLFSSL_SSL_H)
334                 check_c_source_compiles("
335                 #include <wolfssl/options.h>
336                 #if !defined(HAVE_LIGHTY) && !defined(OPENSSL_ALL)
337                 #error HAVE_LIGHTY macro not defined
338                 #endif
339                 int main() { return 0; }
340                 " CHECK_HAVE_LIGHTY)
341                 if (NOT CHECK_HAVE_LIGHTY)
342                         message(FATAL_ERROR "wolfssl must be built with ./configure --enable-lighty")
343                 endif()
344                 unset(CHECK_HAVE_LIGHTY)
346                 set(CMAKE_REQUIRED_LIBRARIES ${WOLFSSL_LIBRARY})
347                 check_library_exists(${WOLFSSL_LIBRARY} wolfSSL_Init "" HAVE_LIBCRYPTO)
348                 if(HAVE_LIBCRYPTO)
349                         set(CRYPTO_LIBRARY ${WOLFSSL_LIBRARY})
350                         add_definitions(-DHAVE_WOLFSSL_SSL_H)
351                 endif()
352                 set(CMAKE_REQUIRED_INCLUDES)
353                 set(CMAKE_REQUIRED_LIBRARIES)
354                 include_directories(${WOLFSSL_INCLUDE_DIR} ${WOLFSSL_INCLUDE_DIR}/wolfssl)
355         endif()
356         unset(WOLFSSL_LIBRARY)
357         unset(WOLFSSL_INCLUDE_DIR)
358 else()
359         unset(HAVE_WOLFSSL_SSL_H)
360 endif()
362 if(WITH_OPENSSL AND WITH_WOLFSSL)
363         message(FATAL_ERROR "lighttpd should not be built with both --with-openssl and --with-wolfssl")
364 endif()
366 if(WITH_PCRE)
367         ## if we have pcre-config, use it
368         xconfig(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS)
369         if(PCRE_LDFLAGS OR PCRE_CFLAGS)
370                 message(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}")
372                 if(NOT PCRE_CFLAGS STREQUAL "\n")
373                         ## if it is empty we'll get newline returned
374                         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}")
375                 endif()
377                 set(HAVE_PCRE_H 1)
378                 set(HAVE_LIBPCRE 1)
379         else()
380                 if(NOT WIN32)
381                         check_include_files(pcre.h HAVE_PCRE_H)
382                         check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
383                         set(PCRE_LDFLAGS -lpcre)
384                 else()
385                         find_path(PCRE_INCLUDE_DIR pcre.h
386                         /usr/local/include
387                         /usr/include
388                         )
390                         set(PCRE_NAMES pcre)
391                         find_library(PCRE_LIBRARY
392                         NAMES ${PCRE_NAMES}
393                         PATHS /usr/lib /usr/local/lib
394                         )
396                         if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
397                                 set(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR})
398                                 set(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY})
399                                 check_include_files(pcre.h HAVE_PCRE_H)
400                                 check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
401                                 set(CMAKE_REQUIRED_INCLUDES)
402                                 set(CMAKE_REQUIRED_LIBRARIES)
403                                 include_directories(${PCRE_INCLUDE_DIR})
404                         endif()
405                 endif()
406         endif()
408         if(NOT HAVE_PCRE_H)
409                 message(FATAL_ERROR "pcre.h couldn't be found")
410         endif()
411         if(NOT HAVE_LIBPCRE)
412                 message(FATAL_ERROR "libpcre couldn't be found")
413         endif()
414 else()
415         unset(HAVE_PCRE_H)
416         unset(HAVE_LIBPCRE)
417 endif()
419 if(WITH_SASL)
420         check_include_files(sasl/sasl.h HAVE_SASL_SASL_H)
421         if(HAVE_SASL_SASL_H)
422                 check_library_exists(sasl2 sasl_server_init "" HAVE_SASL)
423         endif()
424 else()
425         unset(HAVE_SASL_SASL_H)
426         unset(HAVE_SASL)
427 endif()
430 if(WITH_XML)
431         xconfig(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS)
432         if(XML2_LDFLAGS OR XML2_CFLAGS)
433                 message(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}")
435                 ## if it is empty we'll get newline returned
436                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}")
438                 check_include_files(libxml/tree.h HAVE_LIBXML_H)
440                 set(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS})
441                 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
442                 set(CMAKE_REQUIRED_FLAGS)
443         else()
444                 check_include_files(libxml.h HAVE_LIBXML_H)
445                 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
446         endif()
448         if(NOT HAVE_LIBXML_H)
449                 message(FATAL_ERROR "libxml/tree.h couldn't be found")
450         endif()
451         if(NOT HAVE_LIBXML)
452                 message(FATAL_ERROR "libxml2 couldn't be found")
453         endif()
454 else()
455         unset(HAVE_LIBXML_H)
456         unset(HAVE_LIBXML)
457 endif()
459 if(WITH_SQLITE3)
460         check_include_files(sqlite3.h HAVE_SQLITE3_H)
461         check_library_exists(sqlite3 sqlite3_reset "" HAVE_SQLITE3)
462 else()
463         unset(HAVE_SQLITE3_H)
464         unset(HAVE_SQLITE3)
465 endif()
467 if(WITH_UUID)
468         check_include_files(uuid/uuid.h HAVE_UUID_UUID_H)
469         check_library_exists(uuid uuid_generate "" NEED_LIBUUID)
470         if(NOT NEED_LIBUUID)
471                 check_function_exists(uuid_generate HAVE_LIBUUID)
472         else()
473                 set(HAVE_LIBUUID 1)
474         endif()
475 else()
476         unset(HAVE_UUID_UUID_H)
477         unset(NEED_LIBUUID)
478         unset(HAVE_LIBUUID)
479 endif()
481 if(WITH_ZLIB)
482         if(NOT WIN32)
483                 check_include_files(zlib.h HAVE_ZLIB_H)
484                 check_library_exists(z deflate "" HAVE_LIBZ)
485                 set(ZLIB_LIBRARY z)
486         else()
487                 find_path(ZLIB_INCLUDE_DIR zlib.h
488                         /usr/local/include
489                         /usr/include
490                 )
492                 set(ZLIB_NAMES z zlib zdll)
493                         find_library(ZLIB_LIBRARY
494                         NAMES ${ZLIB_NAMES}
495                         PATHS /usr/lib /usr/local/lib
496                 )
498                 if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
499                         set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
500                         set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
501                         get_filename_component(ZLIB_NAME ${ZLIB_LIBRARY} NAME)
502                         check_include_files(zlib.h HAVE_ZLIB_H)
503                         check_library_exists(${ZLIB_NAME} deflate "" HAVE_LIBZ)
504                         set(CMAKE_REQUIRED_INCLUDES)
505                         set(CMAKE_REQUIRED_LIBRARIES)
506                         include_directories(${ZLIB_INCLUDE_DIR})
507                 endif()
508         endif()
509 else()
510         unset(HAVE_ZLIB_H)
511         unset(HAVE_LIBZ)
512         unset(ZLIB_INCLUDE_DIR)
513         unset(ZLIB_LIBRARY)
514 endif()
516 if(WITH_BZIP)
517         check_include_files(bzlib.h HAVE_BZLIB_H)
518         check_library_exists(bz2 BZ2_bzCompress "" HAVE_LIBBZ2)
519 else()
520         unset(HAVE_BZLIB_H)
521         unset(HAVE_LIBBZ2)
522 endif()
524 if(WITH_LDAP)
525         check_include_files(ldap.h HAVE_LDAP_H)
526         check_library_exists(ldap ldap_bind "" HAVE_LIBLDAP)
527         check_include_files(lber.h HAVE_LBER_H)
528         check_library_exists(lber ber_printf "" HAVE_LIBLBER)
529 else()
530         unset(HAVE_LDAP_H)
531         unset(HAVE_LIBLDAP)
532         unset(HAVE_LBER_H)
533         unset(HAVE_LIBLBER)
534 endif()
536 if(WITH_PAM)
537         check_include_files(security/pam_appl.h HAVE_SECURITY_PAM_APPL_H)
538         check_library_exists(pam pam_start "" HAVE_PAM)
539 else()
540         unset(HAVE_SECURITY_PAM_APPL_H)
541         unset(HAVE_PAM)
542 endif()
544 if(WITH_LUA)
545         pkg_search_module(LUA REQUIRED lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua)
546         message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}")
547         set(HAVE_LIBLUA 1 "Have liblua")
548         set(HAVE_LUA_H  1 "Have liblua header")
549 else()
550         unset(HAVE_LIBLUA)
551         unset(HAVE_LUA_H)
552 endif()
554 if(WITH_FAM)
555         check_include_files(fam.h HAVE_FAM_H)
556         check_library_exists(fam FAMOpen2 "" HAVE_LIBFAM)
557         if(HAVE_LIBFAM)
558                 set(CMAKE_REQUIRED_LIBRARIES fam)
559                 check_function_exists(FAMNoExists HAVE_FAMNOEXISTS)
560         endif()
561 else()
562         unset(HAVE_FAM_H)
563         unset(HAVE_LIBFAM)
564         unset(HAVE_FAMNOEXISTS)
565 endif()
567 if(WITH_GDBM)
568         check_include_files(gdbm.h HAVE_GDBM_H)
569         check_library_exists(gdbm gdbm_open "" HAVE_GDBM)
570 else()
571         unset(HAVE_GDBM_H)
572         unset(HAVE_GDBM)
573 endif()
575 if(WITH_MEMCACHED)
576         check_include_files(libmemcached/memcached.h HAVE_LIBMEMCACHED_MEMCACHED_H)
577         check_library_exists(memcached memcached "" HAVE_LIBMEMCACHED)
578         if(HAVE_LIBMEMCACHED_MEMCACHED_H AND HAVE_LIBMEMCACHED)
579                 set(USE_MEMCACHED 1)
580         else()
581                 message(FATAL_ERROR "didn't find libmemcached")
582         endif()
583 endif()
585 if(WITH_GEOIP)
586         check_library_exists(geoip GeoIP_country_name_by_addr "" HAVE_GEOIP)
587 endif()
589 if(NOT BUILD_STATIC)
590         check_include_files(dlfcn.h HAVE_DLFCN_H)
591 else()
592         unset(HAVE_DLFCN_H)
593 endif()
595 if(HAVE_DLFCN_H)
596         check_library_exists(dl dlopen "" HAVE_LIBDL)
597 else()
598         unset(HAVE_LIBDL)
599 endif()
601 set(LIGHTTPD_VERSION_ID 10400)
602 set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
603 set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
605 if(NOT SBINDIR)
606         set(SBINDIR "sbin")
607 endif()
609 if(NOT LIGHTTPD_MODULES_DIR)
610         set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
611 endif()
613 if(NOT WIN32)
614         set(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}")
615 else()
616         ## We use relative path in windows
617         set(LIGHTTPD_LIBRARY_DIR "lib")
618 endif()
620 ## Write out config.h
621 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
623 add_definitions(-DHAVE_CONFIG_H)
625 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
627 set(COMMON_SRC
628         base64.c buffer.c burl.c log.c
629         http_header.c http_kv.c keyvalue.c chunk.c
630         http_chunk.c stream.c fdevent.c gw_backend.c
631         stat_cache.c plugin.c joblist.c etag.c array.c
632         data_string.c data_array.c
633         data_integer.c algo_sha1.c md5.c
634         vector.c
635         fdevent_select.c fdevent_libev.c
636         fdevent_poll.c fdevent_linux_sysepoll.c
637         fdevent_solaris_devpoll.c fdevent_solaris_port.c
638         fdevent_freebsd_kqueue.c
639         data_config.c
640         crc32.c
641         connections-glue.c
642         configfile-glue.c
643         http-header-glue.c
644         http_auth.c
645         http_vhostdb.c
646         request.c
647         sock_addr.c
648         splaytree.c
649         rand.c
650         safe_memclear.c
653 if(WIN32)
654         message(STATUS "Adding local getopt implementation.")
655         set(COMMON_SRC ${COMMON_SRC} xgetopt.c)
656 endif()
658 add_executable(lemon lemon.c)
660 ## Build parsers by using lemon...
661 lemon_parser(configparser.y)
662 lemon_parser(mod_ssi_exprparser.y)
664 set(L_INSTALL_TARGETS)
666 add_executable(lighttpd-angel lighttpd-angel.c)
667 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel)
668 add_target_properties(lighttpd-angel COMPILE_FLAGS "-DSBIN_DIR=\\\\\"${CMAKE_INSTALL_PREFIX}/${SBINDIR}\\\\\"")
670 add_executable(lighttpd
671         server.c
672         response.c
673         connections.c
674         inet_ntop_cache.c
675         network.c
676         network_write.c
677         configfile.c
678         configparser.c
679         ${COMMON_SRC}
681 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
683 add_and_install_library(mod_access mod_access.c)
684 add_and_install_library(mod_accesslog mod_accesslog.c)
685 add_and_install_library(mod_alias mod_alias.c)
686 add_and_install_library(mod_auth "mod_auth.c")
687 add_and_install_library(mod_authn_file "mod_authn_file.c")
688 if(NOT WIN32)
689         add_and_install_library(mod_cgi mod_cgi.c)
690 endif()
691 add_and_install_library(mod_compress mod_compress.c)
692 add_and_install_library(mod_deflate mod_deflate.c)
693 add_and_install_library(mod_dirlisting mod_dirlisting.c)
694 add_and_install_library(mod_evasive mod_evasive.c)
695 add_and_install_library(mod_evhost mod_evhost.c)
696 add_and_install_library(mod_expire mod_expire.c)
697 add_and_install_library(mod_extforward mod_extforward.c)
698 add_and_install_library(mod_fastcgi mod_fastcgi.c)
699 add_and_install_library(mod_flv_streaming mod_flv_streaming.c)
700 add_and_install_library(mod_indexfile mod_indexfile.c)
701 add_and_install_library(mod_proxy mod_proxy.c)
702 add_and_install_library(mod_redirect mod_redirect.c)
703 add_and_install_library(mod_rewrite mod_rewrite.c)
704 add_and_install_library(mod_rrdtool mod_rrdtool.c)
705 add_and_install_library(mod_scgi mod_scgi.c)
706 add_and_install_library(mod_secdownload mod_secdownload.c)
707 add_and_install_library(mod_setenv mod_setenv.c)
708 add_and_install_library(mod_simple_vhost mod_simple_vhost.c)
709 add_and_install_library(mod_sockproxy mod_sockproxy.c)
710 add_and_install_library(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c")
711 add_and_install_library(mod_staticfile mod_staticfile.c)
712 add_and_install_library(mod_status mod_status.c)
713 add_and_install_library(mod_uploadprogress mod_uploadprogress.c)
714 add_and_install_library(mod_userdir mod_userdir.c)
715 add_and_install_library(mod_usertrack mod_usertrack.c)
716 add_and_install_library(mod_vhostdb mod_vhostdb.c)
717 add_and_install_library(mod_webdav mod_webdav.c)
718 add_and_install_library(mod_wstunnel mod_wstunnel.c)
720 add_executable(test_array
721         t/test_array.c
722         array.c
723         data_array.c
724         data_integer.c
725         data_string.c
726         buffer.c
728 add_test(NAME test_array COMMAND test_array)
730 add_executable(test_buffer
731         t/test_buffer.c
732         buffer.c
734 add_test(NAME test_buffer COMMAND test_buffer)
736 add_executable(test_burl
737         t/test_burl.c
738         burl.c
739         buffer.c
740         base64.c
742 add_test(NAME test_burl COMMAND test_burl)
744 add_executable(test_base64
745         t/test_base64.c
746         buffer.c
747         base64.c
749 add_test(NAME test_base64 COMMAND test_base64)
751 add_executable(test_configfile
752         t/test_configfile.c
753         buffer.c
754         array.c
755         data_config.c
756         data_integer.c
757         data_string.c
758         http_header.c
759         http_kv.c
760         vector.c
761         log.c
762         sock_addr.c
764 add_test(NAME test_configfile COMMAND test_configfile)
766 add_executable(test_keyvalue
767         t/test_keyvalue.c
768         burl.c
769         buffer.c
770         base64.c
771         array.c
772         data_integer.c
773         data_string.c
774         log.c
776 add_test(NAME test_keyvalue COMMAND test_keyvalue)
778 add_executable(test_mod_access
779         t/test_mod_access.c
780         configfile-glue.c
781         buffer.c
782         array.c
783         data_config.c
784         data_integer.c
785         data_string.c
786         http_header.c
787         http_kv.c
788         vector.c
789         log.c
790         sock_addr.c
792 add_test(NAME test_mod_access COMMAND test_mod_access)
794 add_executable(test_mod_evhost
795         t/test_mod_evhost.c
796         configfile-glue.c
797         buffer.c
798         array.c
799         data_config.c
800         data_integer.c
801         data_string.c
802         http_header.c
803         http_kv.c
804         vector.c
805         log.c
806         sock_addr.c
808 add_test(NAME test_mod_evhost COMMAND test_mod_evhost)
810 add_executable(test_mod_simple_vhost
811         t/test_mod_simple_vhost.c
812         configfile-glue.c
813         buffer.c
814         array.c
815         data_config.c
816         data_integer.c
817         data_string.c
818         http_header.c
819         http_kv.c
820         vector.c
821         log.c
822         sock_addr.c
824 add_test(NAME test_mod_simple_vhost COMMAND test_mod_simple_vhost)
826 add_executable(test_request
827         t/test_request.c
828         request.c
829         buffer.c
830         array.c
831         data_integer.c
832         data_string.c
833         http_header.c
834         http_kv.c
835         log.c
836         sock_addr.c
838 add_test(NAME test_request COMMAND test_request)
840 if(HAVE_PCRE_H)
841         target_link_libraries(lighttpd ${PCRE_LDFLAGS})
842         add_target_properties(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS})
843         target_link_libraries(mod_rewrite ${PCRE_LDFLAGS})
844         add_target_properties(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS})
845         target_link_libraries(mod_dirlisting ${PCRE_LDFLAGS})
846         add_target_properties(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS})
847         target_link_libraries(mod_redirect ${PCRE_LDFLAGS})
848         add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
849         target_link_libraries(test_configfile ${PCRE_LDFLAGS})
850         add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS})
851         target_link_libraries(test_keyvalue ${PCRE_LDFLAGS})
852         add_target_properties(test_keyvalue COMPILE_FLAGS ${PCRE_CFLAGS})
853         target_link_libraries(test_mod_access ${PCRE_LDFLAGS})
854         add_target_properties(test_mod_access COMPILE_FLAGS ${PCRE_CFLAGS})
855         target_link_libraries(test_mod_evhost ${PCRE_LDFLAGS})
856         add_target_properties(test_mod_evhost COMPILE_FLAGS ${PCRE_CFLAGS})
857         target_link_libraries(test_mod_simple_vhost ${PCRE_LDFLAGS})
858         add_target_properties(test_mod_simple_vhost COMPILE_FLAGS ${PCRE_CFLAGS})
859 endif()
861 if(WITH_PCRE AND (WITH_MEMCACHED OR WITH_GDBM))
862         add_and_install_library(mod_trigger_b4_dl mod_trigger_b4_dl.c)
863         target_link_libraries(mod_trigger_b4_dl ${PCRE_LDFLAGS})
864         add_target_properties(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS})
865 endif()
867 if(WITH_LUA)
868         add_and_install_library(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
869         target_link_libraries(mod_magnet ${LUA_LDFLAGS})
870         add_target_properties(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS})
872         add_and_install_library(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c")
873         target_link_libraries(mod_cml ${LUA_LDFLAGS})
874         add_target_properties(mod_cml COMPILE_FLAGS ${LUA_CFLAGS})
875         if(WITH_MEMCACHED)
876                 target_link_libraries(mod_cml memcached)
877         endif()
878 endif()
880 if(WITH_GEOIP)
881         add_and_install_library(mod_geoip mod_geoip.c)
882         target_link_libraries(mod_geoip GeoIP)
883 endif()
885 if(HAVE_MYSQL_H AND HAVE_MYSQL)
886         add_and_install_library(mod_mysql_vhost "mod_mysql_vhost.c")
887         target_link_libraries(mod_mysql_vhost mysqlclient)
888         add_and_install_library(mod_vhostdb_mysql "mod_vhostdb_mysql.c")
889         target_link_libraries(mod_vhostdb_mysql mysqlclient)
890         include_directories(/usr/include/mysql)
892         add_and_install_library(mod_authn_mysql "mod_authn_mysql.c")
893         set(L_MOD_AUTHN_MYSQL)
894         if(HAVE_LIBCRYPT)
895                 set(L_MOD_AUTHN_MYSQL ${L_MOD_AUTHN_MYSQL} crypt)
896         endif()
897         target_link_libraries(mod_authn_mysql ${L_MOD_AUTHN_MYSQL} mysqlclient)
898 endif()
900 if(HAVE_PGSQL_H AND HAVE_PGSQL)
901         add_and_install_library(mod_vhostdb_pgsql "mod_vhostdb_pgsql.c")
902         target_link_libraries(mod_vhostdb_pgsql pq)
903 endif()
905 if(HAVE_DBI_H AND HAVE_DBI)
906         add_and_install_library(mod_vhostdb_dbi "mod_vhostdb_dbi.c")
907         target_link_libraries(mod_vhostdb_dbi dbi)
908 endif()
910 set(L_MOD_WEBDAV)
911 if(HAVE_SQLITE3_H)
912         set(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3)
913 endif()
914 if(HAVE_LIBXML_H)
915         target_link_libraries(mod_webdav ${XML2_LDFLAGS})
916 endif()
917 if(HAVE_UUID_UUID_H)
918         if(NEED_LIBUUID)
919                 set(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid)
920         endif()
921 endif()
923 target_link_libraries(mod_webdav ${L_MOD_WEBDAV})
925 set(L_MOD_AUTHN_FILE)
926 if(HAVE_LIBCRYPT)
927         set(L_MOD_AUTHN_FILE ${L_MOD_AUTHN_FILE} crypt)
928 endif()
929 target_link_libraries(mod_authn_file ${L_MOD_AUTHN_FILE})
931 if(WITH_KRB5)
932         check_library_exists(krb5 krb5_init_context "" HAVE_KRB5)
933         add_and_install_library(mod_authn_gssapi "mod_authn_gssapi.c")
934         set(L_MOD_AUTHN_GSSAPI ${L_MOD_AUTHN_GSSAPI} krb5 gssapi_krb5)
935         target_link_libraries(mod_authn_gssapi ${L_MOD_AUTHN_GSSAPI})
936 endif()
938 if(WITH_LDAP)
939         set(L_MOD_AUTHN_LDAP ${L_MOD_AUTHN_LDAP} ldap lber)
940         add_and_install_library(mod_authn_ldap "mod_authn_ldap.c")
941         target_link_libraries(mod_authn_ldap ${L_MOD_AUTHN_LDAP})
942         add_and_install_library(mod_vhostdb_ldap "mod_vhostdb_ldap.c")
943         target_link_libraries(mod_vhostdb_ldap ${L_MOD_AUTHN_LDAP})
944 endif()
946 if(WITH_PAM)
947         add_and_install_library(mod_authn_pam "mod_authn_pam.c")
948         set(L_MOD_AUTHN_PAM ${L_MOD_AUTHN_PAM} pam)
949         target_link_libraries(mod_authn_pam ${L_MOD_AUTHN_PAM})
950 endif()
952 if(WITH_SASL)
953         add_and_install_library(mod_authn_sasl "mod_authn_sasl.c")
954         set(L_MOD_AUTHN_SASL ${L_MOD_AUTHN_SASL} sasl2)
955         target_link_libraries(mod_authn_sasl ${L_MOD_AUTHN_SASL})
956 endif()
958 if(HAVE_ZLIB_H)
959         if(HAVE_BZLIB_H)
960                 target_link_libraries(mod_compress ${ZLIB_LIBRARY} bz2)
961                 target_link_libraries(mod_deflate ${ZLIB_LIBRARY} bz2)
962         else()
963                 target_link_libraries(mod_compress ${ZLIB_LIBRARY})
964                 target_link_libraries(mod_deflate ${ZLIB_LIBRARY})
965         endif()
966 endif()
968 if(HAVE_LIBFAM)
969         target_link_libraries(lighttpd fam)
970 endif()
972 if(HAVE_GDBM_H)
973         target_link_libraries(mod_trigger_b4_dl gdbm)
974 endif()
976 if(WITH_MEMCACHED)
977         target_link_libraries(mod_trigger_b4_dl memcached)
978 endif()
980 if(HAVE_XATTR)
981         target_link_libraries(lighttpd attr)
982 endif()
984 if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
985         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_CFLAGS}")
986         set(CMAKE_C_FLAGS_RELEASE        "${CMAKE_C_FLAGS_RELEASE}     -O2")
987         set(CMAKE_C_FLAGS_DEBUG          "${CMAKE_C_FLAGS_DEBUG}       -O0")
988         set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2")
989         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
990         set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
991 endif()
993 if((NOT APPLE) OR CMAKE_C_COMPILER_ID MATCHES "GNU")
994         add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
995 endif()
997 set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
999 if(WIN32)
1000         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND")
1001         add_target_properties(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
1002         target_link_libraries(lighttpd ws2_32)
1003         target_link_libraries(mod_proxy ws2_32)
1004         target_link_libraries(mod_fcgi ws2_32)
1005         target_link_libraries(mod_scgi ws2_32)
1006         target_link_libraries(mod_ssi ws2_32)
1008         if(MINGW)
1009                 target_link_libraries(lighttpd msvcr70)
1010                 add_target_properties(lighttpd LINK_FLAGS "-Wl,-subsystem,console")
1011         endif()
1012 endif()
1014 if(NOT BUILD_STATIC)
1015         if(HAVE_LIBDL)
1016                 target_link_libraries(lighttpd dl)
1017         endif()
1018 endif()
1020 if(NOT ${CRYPTO_LIBRARY} EQUAL "")
1021         if(NOT WITH_WOLFSSL)
1022                 target_link_libraries(lighttpd ssl)
1023         endif()
1024         target_link_libraries(lighttpd ${CRYPTO_LIBRARY})
1025         add_and_install_library(mod_openssl "mod_openssl.c")
1026         if(NOT WITH_WOLFSSL)
1027                 set(L_MOD_OPENSSL ${L_MOD_OPENSSL} ssl)
1028         endif()
1029         set(L_MOD_OPENSSL ${L_MOD_OPENSSL} ${CRYPTO_LIBRARY})
1030         target_link_libraries(mod_openssl ${L_MOD_OPENSSL})
1031         target_link_libraries(mod_auth ${CRYPTO_LIBRARY})
1032         set(L_MOD_AUTHN_FILE ${L_MOD_AUTHN_FILE} ${CRYPTO_LIBRARY})
1033         target_link_libraries(mod_authn_file ${L_MOD_AUTHN_FILE})
1034         target_link_libraries(mod_secdownload ${CRYPTO_LIBRARY})
1035         target_link_libraries(mod_wstunnel ${CRYPTO_LIBRARY})
1036 endif()
1038 if(WITH_LIBEV)
1039         target_link_libraries(lighttpd ${LIBEV_LDFLAGS})
1040         add_target_properties(lighttpd COMPILE_FLAGS ${LIBEV_CFLAGS})
1041 endif()
1043 if(WITH_LIBUNWIND)
1044         target_link_libraries(lighttpd ${LIBUNWIND_LDFLAGS})
1045         add_target_properties(lighttpd COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1047         target_link_libraries(test_array ${LIBUNWIND_LDFLAGS})
1048         add_target_properties(test_array COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1049         target_link_libraries(test_buffer ${LIBUNWIND_LDFLAGS})
1050         add_target_properties(test_buffer COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1051         target_link_libraries(test_burl ${LIBUNWIND_LDFLAGS})
1052         add_target_properties(test_burl COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1053         target_link_libraries(test_base64 ${LIBUNWIND_LDFLAGS})
1054         add_target_properties(test_base64 COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1055         target_link_libraries(test_configfile ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
1056         add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
1057         target_link_libraries(test_keyvalue ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
1058         add_target_properties(test_keyvalue COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
1059         target_link_libraries(test_mod_access ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
1060         add_target_properties(test_mod_access COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
1061         target_link_libraries(test_mod_evhost ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
1062         add_target_properties(test_mod_evhost COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
1063         target_link_libraries(test_mod_simple_vhost ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
1064         add_target_properties(test_mod_simple_vhost COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
1065         target_link_libraries(test_request ${LIBUNWIND_LDFLAGS})
1066         add_target_properties(test_request COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
1067 endif()
1069 if(NOT WIN32)
1070 install(TARGETS ${L_INSTALL_TARGETS}
1071         RUNTIME DESTINATION ${SBINDIR}
1072         LIBRARY DESTINATION ${LIGHTTPD_MODULES_DIR}
1073         ARCHIVE DESTINATION ${LIGHTTPD_MODULES_DIR}/static)
1074 else()
1075 ## HACK to make win32 to install our libraries in desired directory..
1076 install(TARGETS lighttpd
1077         RUNTIME DESTINATION ${SBINDIR}
1078         ARCHIVE DESTINATION lib/static)
1079 list(REMOVE_ITEM L_INSTALL_TARGETS lighttpd)
1080 install(TARGETS ${L_INSTALL_TARGETS}
1081         RUNTIME DESTINATION ${SBINDIR}/lib
1082         LIBRARY DESTINATION lib
1083         ARCHIVE DESTINATION lib/static)
1084 endif()