1 include(CheckCSourceCompiles)
2 include(CheckIncludeFiles)
3 include(CheckFunctionExists)
4 include(CheckVariableExists)
6 include(CheckLibraryExists)
7 include(CMakeDetermineCCompiler)
11 include(LighttpdMacros)
13 add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
15 option(WITH_XATTR "with xattr-support for the stat-cache [default: off]")
16 option(WITH_MYSQL "with mysql-support for the mod_sql_vhost [default: off]")
17 # option(WITH_POSTGRESQL "with postgress-support for the mod_sql_vhost [default: off]")
18 option(WITH_OPENSSL "with openssl-support [default: off]")
19 option(WITH_PCRE "with regex support [default: on]" ON)
20 option(WITH_WEBDAV_PROPS "with property-support for mod_webdav [default: off]")
21 option(WITH_WEBDAV_LOCKS "locks in webdav [default: off]")
22 option(WITH_BZIP "with bzip2-support for mod_compress [default: off]")
23 option(WITH_ZLIB "with deflate-support for mod_compress [default: on]" ON)
24 option(WITH_LDAP "with LDAP-support for the mod_auth [default: off]")
25 option(WITH_LUA "with lua 5.1 for mod_magnet [default: off]")
26 # option(WITH_VALGRIND "with internal support for valgrind [default: off]")
27 # option(WITH_KERBEROS5 "use Kerberos5 support with OpenSSL [default: off]")
28 option(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]")
29 option(WITH_GDBM "gdbm storage for mod_trigger_b4_dl [default: off]")
30 option(WITH_MEMCACHED "memcached storage for mod_trigger_b4_dl [default: off]")
31 option(WITH_LIBEV "libev support for fdevent handlers [default: off]")
32 option(WITH_LIBUNWIND "with libunwind to print backtraces in asserts [default: off]")
34 if(CMAKE_COMPILER_IS_GNUCC)
35 option(BUILD_EXTRA_WARNINGS "extra warnings")
37 if(BUILD_EXTRA_WARNINGS)
38 set(WARN_CFLAGS "-g -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security")
39 set(WARN_LDFLAGS "-Wl,--as-needed")
40 # -Werror -Wbad-function-cast -Wmissing-prototypes
44 option(BUILD_STATIC "build a static lighttpd with all modules added")
47 set(LIGHTTPD_STATIC 1)
49 set(CMAKE_SHARED_MODULE_PREFIX "")
51 set(CMAKE_SHARED_LIBRARY_PREFIX "")
55 find_package(LibEV REQUIRED)
60 pkg_check_modules(LIBUNWIND REQUIRED libunwind)
70 check_include_files(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
71 check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
72 check_include_files(sys/event.h HAVE_SYS_EVENT_H)
73 check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
74 check_include_files(sys/poll.h HAVE_SYS_POLL_H)
75 check_include_files(sys/port.h HAVE_SYS_PORT_H)
76 check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
77 check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
78 check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
79 check_include_files(sys/select.h HAVE_SYS_SELECT_H)
80 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
81 check_include_files(sys/uio.h HAVE_SYS_UIO_H)
82 check_include_files(sys/un.h HAVE_SYS_UN_H)
83 check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
84 check_include_files(sys/time.h HAVE_SYS_TIME_H)
85 check_include_files(unistd.h HAVE_UNISTD_H)
86 check_include_files(pthread.h HAVE_PTHREAD_H)
87 check_include_files(getopt.h HAVE_GETOPT_H)
88 check_include_files(inttypes.h HAVE_INTTYPES_H)
89 check_include_files(poll.h HAVE_POLL_H)
90 check_include_files(pwd.h HAVE_PWD_H)
91 check_include_files(stddef.h HAVE_STDDEF_H)
92 check_include_files(stdint.h HAVE_STDINT_H)
93 check_include_files(syslog.h HAVE_SYSLOG_H)
95 # check for fastcgi lib, for the tests only
96 check_include_files(fastcgi.h HAVE_FASTCGI_H)
97 check_include_files(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H)
99 # will be needed for auth
100 check_include_files(crypt.h HAVE_CRYPT_H)
101 # check if we need libcrypt for crypt_r()
102 check_library_exists(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R)
103 if(HAVE_LIBCRYPT_CRYPT_R)
107 check_library_exists(crypt crypt "" HAVE_LIBCRYPT)
109 check_function_exists(crypt_r HAVE_CRYPT_R)
110 check_function_exists(crypt HAVE_CRYPT)
112 check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
113 if(HAVE_SYS_INOTIFY_H)
114 check_function_exists(inotify_init HAVE_INOTIFY_INIT)
117 set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
118 check_type_size(socklen_t HAVE_SOCKLEN_T)
119 set(CMAKE_EXTRA_INCLUDE_FILES)
121 check_type_size(long SIZEOF_LONG)
122 check_type_size(off_t SIZEOF_OFF_T)
124 check_function_exists(chroot HAVE_CHROOT)
125 check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
126 check_function_exists(fork HAVE_FORK)
127 check_function_exists(getrlimit HAVE_GETRLIMIT)
128 check_function_exists(getuid HAVE_GETUID)
129 check_function_exists(gmtime_r HAVE_GMTIME_R)
130 check_function_exists(inet_ntop HAVE_INET_NTOP)
131 check_function_exists(kqueue HAVE_KQUEUE)
132 check_function_exists(localtime_r HAVE_LOCALTIME_R)
133 check_function_exists(lstat HAVE_LSTAT)
134 check_function_exists(madvise HAVE_MADVISE)
135 check_function_exists(memcpy HAVE_MEMCPY)
136 check_function_exists(memset HAVE_MEMSET)
137 check_function_exists(mmap HAVE_MMAP)
138 check_function_exists(pathconf HAVE_PATHCONF)
139 check_function_exists(poll HAVE_POLL)
140 check_function_exists(port_create HAVE_PORT_CREATE)
141 check_function_exists(prctl HAVE_PRCTL)
142 check_function_exists(pread HAVE_PREAD)
143 check_function_exists(posix_fadvise HAVE_POSIX_FADVISE)
144 check_function_exists(select HAVE_SELECT)
145 check_function_exists(sendfile HAVE_SENDFILE)
146 check_function_exists(send_file HAVE_SEND_FILE)
147 check_function_exists(sendfile64 HAVE_SENDFILE64)
148 check_function_exists(sendfilev HAVE_SENDFILEV)
149 check_function_exists(sigaction HAVE_SIGACTION)
150 check_function_exists(signal HAVE_SIGNAL)
151 check_function_exists(sigtimedwait HAVE_SIGTIMEDWAIT)
152 check_function_exists(strptime HAVE_STRPTIME)
153 check_function_exists(syslog HAVE_SYSLOG)
154 check_function_exists(writev HAVE_WRITEV)
155 check_function_exists(inet_aton HAVE_INET_ATON)
156 check_function_exists(issetugid HAVE_ISSETUGID)
157 check_function_exists(inet_pton HAVE_INET_PTON)
158 check_function_exists(memset_s HAVE_MEMSET_S)
159 check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
160 check_c_source_compiles("
161 #include <sys/types.h>
162 #include <sys/socket.h>
163 #include <netinet/in.h>
166 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
169 check_c_source_compiles("
170 __attribute__((weak)) void __dummy(void *x) { }
178 macro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
179 # reset the variables at the beginning
185 find_program(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin )
187 # if pkg-config has been found
188 if(${_package}CONFIG_EXECUTABLE)
189 set(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}")
190 message(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}")
192 exec_program(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS)
193 string(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS})
194 exec_program(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags)
195 string(REPLACE "\n" "" ${_cflags} ${__cflags})
197 message(STATUS "found ${_package}: no")
199 endmacro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
202 check_include_files(attr/attributes.h HAVE_ATTR_ATTRIBUTES_H)
203 if(HAVE_ATTR_ATTRIBUTES_H)
204 check_library_exists(attr attr_get "" HAVE_XATTR)
207 unset(HAVE_ATTR_ATTRIBUTES_H)
212 xconfig(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS)
214 set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql)
215 check_include_files(mysql.h HAVE_MYSQL_H)
216 set(CMAKE_REQUIRED_INCLUDES)
218 check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL)
227 set(CMAKE_REQUIRED_INCLUDES /opt/local/include)
229 check_include_files(openssl/ssl.h HAVE_OPENSSL_SSL_H)
231 set(CMAKE_REQUIRED_INCLUDES)
233 if(HAVE_OPENSSL_SSL_H)
234 check_library_exists(crypto BIO_f_base64 "" HAVE_LIBCRYPTO)
236 check_library_exists(ssl SSL_new "" HAVE_LIBSSL)
240 unset(HAVE_OPENSSL_SSL_H)
241 unset(HAVE_LIBCRYPTO)
246 ## if we have pcre-config, use it
247 xconfig(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS)
248 if(PCRE_LDFLAGS OR PCRE_CFLAGS)
249 message(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}")
251 if(NOT PCRE_CFLAGS STREQUAL "\n")
252 ## if it is empty we'll get newline returned
253 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}")
260 check_include_files(pcre.h HAVE_PCRE_H)
261 check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
262 set(PCRE_LDFLAGS -lpcre)
264 find_path(PCRE_INCLUDE_DIR pcre.h
270 find_library(PCRE_LIBRARY
272 PATHS /usr/lib /usr/local/lib
275 if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
276 set(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR})
277 set(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY})
278 check_include_files(pcre.h HAVE_PCRE_H)
279 check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
280 set(CMAKE_REQUIRED_INCLUDES)
281 set(CMAKE_REQUIRED_LIBRARIES)
282 include_directories(${PCRE_INCLUDE_DIR})
288 message(FATAL_ERROR "pcre.h couldn't be found")
291 message(FATAL_ERROR "libpcre couldn't be found")
300 xconfig(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS)
301 if(XML2_LDFLAGS OR XML2_CFLAGS)
302 message(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}")
304 ## if it is empty we'll get newline returned
305 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}")
307 check_include_files(libxml/tree.h HAVE_LIBXML_H)
309 set(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS})
310 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
311 set(CMAKE_REQUIRED_FLAGS)
313 check_include_files(libxml.h HAVE_LIBXML_H)
314 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
317 if(NOT HAVE_LIBXML_H)
318 message(FATAL_ERROR "libxml/tree.h couldn't be found")
321 message(FATAL_ERROR "libxml2 couldn't be found")
329 check_include_files(sqlite3.h HAVE_SQLITE3_H)
330 check_library_exists(sqlite3 sqlite3_reset "" HAVE_SQLITE3)
332 unset(HAVE_SQLITE3_H)
337 check_include_files(uuid/uuid.h HAVE_UUID_UUID_H)
338 check_library_exists(uuid uuid_generate "" NEED_LIBUUID)
340 check_function_exists(uuid_generate HAVE_LIBUUID)
345 unset(HAVE_UUID_UUID_H)
352 check_include_files(zlib.h HAVE_ZLIB_H)
353 check_library_exists(z deflate "" HAVE_LIBZ)
356 find_path(ZLIB_INCLUDE_DIR zlib.h
361 set(ZLIB_NAMES z zlib zdll)
362 find_library(ZLIB_LIBRARY
364 PATHS /usr/lib /usr/local/lib
367 if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
368 set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
369 set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
370 get_filename_component(ZLIB_NAME ${ZLIB_LIBRARY} NAME)
371 check_include_files(zlib.h HAVE_ZLIB_H)
372 check_library_exists(${ZLIB_NAME} deflate "" HAVE_LIBZ)
373 set(CMAKE_REQUIRED_INCLUDES)
374 set(CMAKE_REQUIRED_LIBRARIES)
375 include_directories(${ZLIB_INCLUDE_DIR})
381 unset(ZLIB_INCLUDE_DIR)
386 check_include_files(bzlib.h HAVE_BZLIB_H)
387 check_library_exists(bz2 BZ2_bzCompress "" HAVE_LIBBZ2)
394 check_include_files(ldap.h HAVE_LDAP_H)
395 check_library_exists(ldap ldap_bind "" HAVE_LIBLDAP)
396 check_include_files(lber.h HAVE_LBER_H)
397 check_library_exists(lber ber_printf "" HAVE_LIBLBER)
398 set(LDAP_DEPRECATED 1) # Using deprecated ldap api
407 pkg_search_module(LUA REQUIRED lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua)
408 message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}")
409 set(HAVE_LIBLUA 1 "Have liblua")
410 set(HAVE_LUA_H 1 "Have liblua header")
417 check_include_files(fam.h HAVE_FAM_H)
418 check_library_exists(fam FAMOpen2 "" HAVE_LIBFAM)
420 set(CMAKE_REQUIRED_LIBRARIES fam)
421 check_function_exists(FAMNoExists HAVE_FAMNOEXISTS)
426 unset(HAVE_FAMNOEXISTS)
430 check_include_files(gdbm.h HAVE_GDBM_H)
431 check_library_exists(gdbm gdbm_open "" HAVE_GDBM)
438 check_include_files(libmemcached/memcached.h HAVE_LIBMEMCACHED_MEMCACHED_H)
439 check_library_exists(memcached memcached "" HAVE_LIBMEMCACHED)
440 if(HAVE_LIBMEMCACHED_MEMCACHED_H AND HAVE_LIBMEMCACHED)
443 message(FATAL_ERROR "didn't find libmemcached")
448 check_include_files(dlfcn.h HAVE_DLFCN_H)
454 check_library_exists(dl dlopen "" HAVE_LIBDL)
459 set(LIGHTTPD_VERSION_ID 10400)
460 set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
461 set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
467 if(NOT LIGHTTPD_MODULES_DIR)
468 set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
472 set(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}")
474 ## We use relative path in windows
475 set(LIGHTTPD_LIBRARY_DIR "lib")
478 ## Write out config.h
479 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
481 add_definitions(-DHAVE_CONFIG_H)
483 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
486 base64.c buffer.c log.c
488 http_chunk.c stream.c fdevent.c
489 stat_cache.c plugin.c joblist.c etag.c array.c
490 data_string.c data_count.c data_array.c
491 data_integer.c md5.c data_fastcgi.c
493 fdevent_select.c fdevent_libev.c
494 fdevent_poll.c fdevent_linux_sysepoll.c
495 fdevent_solaris_devpoll.c fdevent_solaris_port.c
496 fdevent_freebsd_kqueue.c
498 inet_ntop_cache.c crc32.c
502 splaytree.c network_writev.c
503 network_write_mmap.c network_write_no_mmap.c
504 network_write.c network_linux_sendfile.c
505 network_freebsd_sendfile.c
506 network_solaris_sendfilev.c network_openssl.c
507 status_counter.c safe_memclear.c network_darwin_sendfile.c
511 message(STATUS "Adding local getopt implementation.")
512 set(COMMON_SRC ${COMMON_SRC} xgetopt.c)
515 add_executable(lemon lemon.c)
517 ## Build parsers by using lemon...
518 lemon_parser(configparser.y)
519 lemon_parser(mod_ssi_exprparser.y)
521 set(L_INSTALL_TARGETS)
523 add_executable(lighttpd-angel lighttpd-angel.c)
524 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel)
525 add_target_properties(lighttpd-angel COMPILE_FLAGS "-DSBIN_DIR=\\\\\"${CMAKE_INSTALL_PREFIX}/${SBINDIR}\\\\\"")
527 add_executable(lighttpd
538 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
540 add_and_install_library(mod_access mod_access.c)
541 add_and_install_library(mod_accesslog mod_accesslog.c)
542 add_and_install_library(mod_alias mod_alias.c)
543 add_and_install_library(mod_auth "mod_auth.c;http_auth.c")
545 add_and_install_library(mod_cgi mod_cgi.c)
547 add_and_install_library(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c")
548 add_and_install_library(mod_compress mod_compress.c)
549 add_and_install_library(mod_dirlisting mod_dirlisting.c)
550 add_and_install_library(mod_evasive mod_evasive.c)
551 add_and_install_library(mod_evhost mod_evhost.c)
552 add_and_install_library(mod_expire mod_expire.c)
553 add_and_install_library(mod_extforward mod_extforward.c)
554 add_and_install_library(mod_fastcgi mod_fastcgi.c)
555 add_and_install_library(mod_flv_streaming mod_flv_streaming.c)
556 add_and_install_library(mod_indexfile mod_indexfile.c)
557 add_and_install_library(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
558 add_and_install_library(mod_mysql_vhost mod_mysql_vhost.c)
559 add_and_install_library(mod_proxy mod_proxy.c)
560 add_and_install_library(mod_redirect mod_redirect.c)
561 add_and_install_library(mod_rewrite mod_rewrite.c)
562 add_and_install_library(mod_rrdtool mod_rrdtool.c)
563 add_and_install_library(mod_scgi mod_scgi.c)
564 add_and_install_library(mod_secdownload mod_secdownload.c)
565 add_and_install_library(mod_setenv mod_setenv.c)
566 add_and_install_library(mod_simple_vhost mod_simple_vhost.c)
567 add_and_install_library(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c")
568 add_and_install_library(mod_staticfile mod_staticfile.c)
569 add_and_install_library(mod_status mod_status.c)
570 add_and_install_library(mod_trigger_b4_dl mod_trigger_b4_dl.c)
571 # add_and_install_library(mod_uploadprogress mod_uploadprogress.c)
572 add_and_install_library(mod_userdir mod_userdir.c)
573 add_and_install_library(mod_usertrack mod_usertrack.c)
574 add_and_install_library(mod_webdav mod_webdav.c)
576 add_executable(test_buffer
580 add_test(NAME test_buffer COMMAND test_buffer)
582 add_executable(test_base64
587 add_test(NAME test_base64 COMMAND test_base64)
589 add_executable(test_configfile
597 add_test(NAME test_configfile COMMAND test_configfile)
600 target_link_libraries(lighttpd ${PCRE_LDFLAGS})
601 add_target_properties(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS})
602 target_link_libraries(mod_rewrite ${PCRE_LDFLAGS})
603 add_target_properties(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS})
604 target_link_libraries(mod_dirlisting ${PCRE_LDFLAGS})
605 add_target_properties(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS})
606 target_link_libraries(mod_redirect ${PCRE_LDFLAGS})
607 add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
608 target_link_libraries(mod_trigger_b4_dl ${PCRE_LDFLAGS})
609 add_target_properties(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS})
610 target_link_libraries(test_configfile ${PCRE_LDFLAGS})
611 add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS})
614 target_link_libraries(mod_magnet ${LUA_LDFLAGS})
615 add_target_properties(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS})
617 target_link_libraries(mod_cml ${LUA_LDFLAGS})
618 add_target_properties(mod_cml COMPILE_FLAGS ${LUA_CFLAGS})
620 if(HAVE_MYSQL_H AND HAVE_MYSQL)
621 target_link_libraries(mod_mysql_vhost mysqlclient)
622 include_directories(/usr/include/mysql)
627 set(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3)
630 target_link_libraries(mod_webdav ${XML2_LDFLAGS})
634 set(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid)
638 target_link_libraries(mod_webdav ${L_MOD_WEBDAV})
642 set(L_MOD_AUTH ${L_MOD_AUTH} crypt)
646 set(L_MOD_AUTH ${L_MOD_AUTH} ldap lber)
648 target_link_libraries(mod_auth ${L_MOD_AUTH})
652 target_link_libraries(mod_compress ${ZLIB_LIBRARY} bz2)
654 target_link_libraries(mod_compress ${ZLIB_LIBRARY})
659 target_link_libraries(lighttpd fam)
663 target_link_libraries(mod_trigger_b4_dl gdbm)
667 target_link_libraries(mod_trigger_b4_dl memcached)
670 if(CMAKE_COMPILER_IS_GNUCC)
671 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_CFLAGS}")
672 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
673 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
674 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2")
675 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
676 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
677 add_definitions(-D_GNU_SOURCE)
680 if((NOT APPLE) OR CMAKE_COMPILER_IS_GNUCC)
681 add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
684 set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
687 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND")
688 add_target_properties(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
689 target_link_libraries(lighttpd ws2_32)
690 target_link_libraries(mod_proxy ws2_32)
691 target_link_libraries(mod_fcgi ws2_32)
692 target_link_libraries(mod_scgi ws2_32)
693 target_link_libraries(mod_ssi ws2_32)
696 target_link_libraries(lighttpd msvcr70)
697 add_target_properties(lighttpd LINK_FLAGS "-Wl,-subsystem,console")
703 target_link_libraries(lighttpd dl)
707 if(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
708 target_link_libraries(lighttpd ssl)
709 target_link_libraries(lighttpd crypto)
713 target_link_libraries(lighttpd ${LIBEV_LDFLAGS})
714 add_target_properties(lighttpd COMPILE_FLAGS ${LIBEV_CFLAGS})
718 target_link_libraries(lighttpd ${LIBUNWIND_LDFLAGS})
719 add_target_properties(lighttpd COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
721 target_link_libraries(test_buffer ${LIBUNWIND_LDFLAGS})
722 add_target_properties(test_buffer COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
723 target_link_libraries(test_base64 ${LIBUNWIND_LDFLAGS})
724 add_target_properties(test_base64 COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
725 target_link_libraries(test_configfile ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
726 add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
730 install(TARGETS ${L_INSTALL_TARGETS}
731 RUNTIME DESTINATION ${SBINDIR}
732 LIBRARY DESTINATION ${LIGHTTPD_MODULES_DIR}
733 ARCHIVE DESTINATION ${LIGHTTPD_MODULES_DIR}/static)
735 ## HACK to make win32 to install our libraries in desired directory..
736 install(TARGETS lighttpd
737 RUNTIME DESTINATION ${SBINDIR}
738 ARCHIVE DESTINATION lib/static)
739 list(REMOVE_ITEM L_INSTALL_TARGETS lighttpd)
740 install(TARGETS ${L_INSTALL_TARGETS}
741 RUNTIME DESTINATION ${SBINDIR}/lib
742 LIBRARY DESTINATION lib
743 ARCHIVE DESTINATION lib/static)