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_LIBRARY_PREFIX "")
53 find_package(LibEV REQUIRED)
58 pkg_check_modules(LIBUNWIND REQUIRED libunwind)
68 check_include_files(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
69 check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
70 check_include_files(sys/event.h HAVE_SYS_EVENT_H)
71 check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
72 check_include_files(sys/poll.h HAVE_SYS_POLL_H)
73 check_include_files(sys/port.h HAVE_SYS_PORT_H)
74 check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
75 check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
76 check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
77 check_include_files(sys/select.h HAVE_SYS_SELECT_H)
78 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
79 check_include_files(sys/uio.h HAVE_SYS_UIO_H)
80 check_include_files(sys/un.h HAVE_SYS_UN_H)
81 check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
82 check_include_files(sys/time.h HAVE_SYS_TIME_H)
83 check_include_files(unistd.h HAVE_UNISTD_H)
84 check_include_files(pthread.h HAVE_PTHREAD_H)
85 check_include_files(getopt.h HAVE_GETOPT_H)
86 check_include_files(inttypes.h HAVE_INTTYPES_H)
87 check_include_files(poll.h HAVE_POLL_H)
88 check_include_files(pwd.h HAVE_PWD_H)
89 check_include_files(stddef.h HAVE_STDDEF_H)
90 check_include_files(stdint.h HAVE_STDINT_H)
91 check_include_files(syslog.h HAVE_SYSLOG_H)
93 # check for fastcgi lib, for the tests only
94 check_include_files(fastcgi.h HAVE_FASTCGI_H)
95 check_include_files(fastcgi/fastcgi.h HAVE_FASTCGI_FASTCGI_H)
97 # will be needed for auth
98 check_include_files(crypt.h HAVE_CRYPT_H)
99 # check if we need libcrypt for crypt_r()
100 check_library_exists(crypt crypt_r "" HAVE_LIBCRYPT_CRYPT_R)
101 if(HAVE_LIBCRYPT_CRYPT_R)
105 check_library_exists(crypt crypt "" HAVE_LIBCRYPT)
107 check_function_exists(crypt_r HAVE_CRYPT_R)
108 check_function_exists(crypt HAVE_CRYPT)
110 check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
111 if(HAVE_SYS_INOTIFY_H)
112 check_function_exists(inotify_init HAVE_INOTIFY_INIT)
115 set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
116 check_type_size(socklen_t HAVE_SOCKLEN_T)
117 set(CMAKE_EXTRA_INCLUDE_FILES)
119 check_type_size(long SIZEOF_LONG)
120 check_type_size(off_t SIZEOF_OFF_T)
122 check_function_exists(chroot HAVE_CHROOT)
123 check_function_exists(epoll_ctl HAVE_EPOLL_CTL)
124 check_function_exists(fork HAVE_FORK)
125 check_function_exists(getrlimit HAVE_GETRLIMIT)
126 check_function_exists(getuid HAVE_GETUID)
127 check_function_exists(gmtime_r HAVE_GMTIME_R)
128 check_function_exists(inet_ntop HAVE_INET_NTOP)
129 check_function_exists(kqueue HAVE_KQUEUE)
130 check_function_exists(localtime_r HAVE_LOCALTIME_R)
131 check_function_exists(lstat HAVE_LSTAT)
132 check_function_exists(madvise HAVE_MADVISE)
133 check_function_exists(memcpy HAVE_MEMCPY)
134 check_function_exists(memset HAVE_MEMSET)
135 check_function_exists(mmap HAVE_MMAP)
136 check_function_exists(pathconf HAVE_PATHCONF)
137 check_function_exists(poll HAVE_POLL)
138 check_function_exists(port_create HAVE_PORT_CREATE)
139 check_function_exists(prctl HAVE_PRCTL)
140 check_function_exists(pread HAVE_PREAD)
141 check_function_exists(posix_fadvise HAVE_POSIX_FADVISE)
142 check_function_exists(select HAVE_SELECT)
143 check_function_exists(sendfile HAVE_SENDFILE)
144 check_function_exists(send_file HAVE_SEND_FILE)
145 check_function_exists(sendfile64 HAVE_SENDFILE64)
146 check_function_exists(sendfilev HAVE_SENDFILEV)
147 check_function_exists(sigaction HAVE_SIGACTION)
148 check_function_exists(signal HAVE_SIGNAL)
149 check_function_exists(sigtimedwait HAVE_SIGTIMEDWAIT)
150 check_function_exists(strptime HAVE_STRPTIME)
151 check_function_exists(syslog HAVE_SYSLOG)
152 check_function_exists(writev HAVE_WRITEV)
153 check_function_exists(inet_aton HAVE_INET_ATON)
154 check_function_exists(issetugid HAVE_ISSETUGID)
155 check_function_exists(inet_pton HAVE_INET_PTON)
156 check_function_exists(memset_s HAVE_MEMSET_S)
157 check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
158 check_c_source_compiles("
159 #include <sys/types.h>
160 #include <sys/socket.h>
161 #include <netinet/in.h>
164 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
167 check_c_source_compiles("
168 __attribute__((weak)) void __dummy(void *x) { }
176 macro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
177 # reset the variables at the beginning
183 find_program(${_package}CONFIG_EXECUTABLE NAMES ${_package} PATHS /usr/local/bin )
185 # if pkg-config has been found
186 if(${_package}CONFIG_EXECUTABLE)
187 set(XCONFIG_EXECUTABLE "${${_package}CONFIG_EXECUTABLE}")
188 message(STATUS "found ${_package}: ${XCONFIG_EXECUTABLE}")
190 exec_program(${XCONFIG_EXECUTABLE} ARGS --libs OUTPUT_VARIABLE __link_FLAGS)
191 string(REPLACE "\n" "" ${_link_FLAGS} ${__link_FLAGS})
192 exec_program(${XCONFIG_EXECUTABLE} ARGS --cflags OUTPUT_VARIABLE __cflags)
193 string(REPLACE "\n" "" ${_cflags} ${__cflags})
195 message(STATUS "found ${_package}: no")
197 endmacro(XCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
200 check_include_files(attr/attributes.h HAVE_ATTR_ATTRIBUTES_H)
201 if(HAVE_ATTR_ATTRIBUTES_H)
202 check_library_exists(attr attr_get "" HAVE_XATTR)
205 unset(HAVE_ATTR_ATTRIBUTES_H)
210 xconfig(mysql_config MYSQL_INCDIR MYSQL_LIBDIR MYSQL_LDFLAGS MYSQL_CFLAGS)
212 set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql)
213 check_include_files(mysql.h HAVE_MYSQL_H)
214 set(CMAKE_REQUIRED_INCLUDES)
216 check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL)
224 check_include_files(openssl/ssl.h HAVE_OPENSSL_SSL_H)
225 if(HAVE_OPENSSL_SSL_H)
226 check_library_exists(crypto BIO_f_base64 "" HAVE_LIBCRYPTO)
228 set(OPENSSL_NO_KRB5 1)
229 check_library_exists(ssl SSL_new "" HAVE_LIBSSL)
233 unset(HAVE_OPENSSL_SSL_H)
234 unset(HAVE_LIBCRYPTO)
239 ## if we have pcre-config, use it
240 xconfig(pcre-config PCRE_INCDIR PCRE_LIBDIR PCRE_LDFLAGS PCRE_CFLAGS)
241 if(PCRE_LDFLAGS OR PCRE_CFLAGS)
242 message(STATUS "found pcre at: LDFLAGS: ${PCRE_LDFLAGS} CFLAGS: ${PCRE_CFLAGS}")
244 if(NOT PCRE_CFLAGS STREQUAL "\n")
245 ## if it is empty we'll get newline returned
246 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PCRE_CFLAGS}")
253 check_include_files(pcre.h HAVE_PCRE_H)
254 check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
255 set(PCRE_LDFLAGS -lpcre)
257 find_path(PCRE_INCLUDE_DIR pcre.h
263 find_library(PCRE_LIBRARY
265 PATHS /usr/lib /usr/local/lib
268 if(PCRE_INCLUDE_DIR AND PCRE_LIBRARY)
269 set(CMAKE_REQUIRED_INCLUDES ${PCRE_INCLUDE_DIR})
270 set(CMAKE_REQUIRED_LIBRARIES ${PCRE_LIBRARY})
271 check_include_files(pcre.h HAVE_PCRE_H)
272 check_library_exists(pcre pcre_exec "" HAVE_LIBPCRE)
273 set(CMAKE_REQUIRED_INCLUDES)
274 set(CMAKE_REQUIRED_LIBRARIES)
275 include_directories(${PCRE_INCLUDE_DIR})
281 message(FATAL_ERROR "pcre.h couldn't be found")
284 message(FATAL_ERROR "libpcre couldn't be found")
293 xconfig(xml2-config XML2_INCDIR XML2_LIBDIR XML2_LDFLAGS XML2_CFLAGS)
294 if(XML2_LDFLAGS OR XML2_CFLAGS)
295 message(STATUS "found xml2 at: LDFLAGS: ${XML2_LDFLAGS} CFLAGS: ${XML2_CFLAGS}")
297 ## if it is empty we'll get newline returned
298 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XML2_CFLAGS}")
300 check_include_files(libxml/tree.h HAVE_LIBXML_H)
302 set(CMAKE_REQUIRED_FLAGS ${XML2_LDFLAGS})
303 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
304 set(CMAKE_REQUIRED_FLAGS)
306 check_include_files(libxml.h HAVE_LIBXML_H)
307 check_library_exists(xml2 xmlParseChunk "" HAVE_LIBXML)
310 if(NOT HAVE_LIBXML_H)
311 message(FATAL_ERROR "libxml/tree.h couldn't be found")
314 message(FATAL_ERROR "libxml2 couldn't be found")
322 check_include_files(sqlite3.h HAVE_SQLITE3_H)
323 check_library_exists(sqlite3 sqlite3_reset "" HAVE_SQLITE3)
325 unset(HAVE_SQLITE3_H)
330 check_include_files(uuid/uuid.h HAVE_UUID_UUID_H)
331 check_library_exists(uuid uuid_generate "" NEED_LIBUUID)
333 check_function_exists(uuid_generate HAVE_LIBUUID)
338 unset(HAVE_UUID_UUID_H)
345 check_include_files(zlib.h HAVE_ZLIB_H)
346 check_library_exists(z deflate "" HAVE_LIBZ)
349 find_path(ZLIB_INCLUDE_DIR zlib.h
354 set(ZLIB_NAMES z zlib zdll)
355 find_library(ZLIB_LIBRARY
357 PATHS /usr/lib /usr/local/lib
360 if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
361 set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
362 set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY})
363 get_filename_component(ZLIB_NAME ${ZLIB_LIBRARY} NAME)
364 check_include_files(zlib.h HAVE_ZLIB_H)
365 check_library_exists(${ZLIB_NAME} deflate "" HAVE_LIBZ)
366 set(CMAKE_REQUIRED_INCLUDES)
367 set(CMAKE_REQUIRED_LIBRARIES)
368 include_directories(${ZLIB_INCLUDE_DIR})
374 unset(ZLIB_INCLUDE_DIR)
379 check_include_files(bzlib.h HAVE_BZLIB_H)
380 check_library_exists(bz2 BZ2_bzCompress "" HAVE_LIBBZ2)
387 check_include_files(ldap.h HAVE_LDAP_H)
388 check_library_exists(ldap ldap_bind "" HAVE_LIBLDAP)
389 check_include_files(lber.h HAVE_LBER_H)
390 check_library_exists(lber ber_printf "" HAVE_LIBLBER)
391 set(LDAP_DEPRECATED 1) # Using deprecated ldap api
400 pkg_search_module(LUA REQUIRED lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua)
401 message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}")
402 set(HAVE_LIBLUA 1 "Have liblua")
403 set(HAVE_LUA_H 1 "Have liblua header")
410 check_include_files(fam.h HAVE_FAM_H)
411 check_library_exists(fam FAMOpen2 "" HAVE_LIBFAM)
413 set(CMAKE_REQUIRED_LIBRARIES fam)
414 check_function_exists(FAMNoExists HAVE_FAMNOEXISTS)
419 unset(HAVE_FAMNOEXISTS)
423 check_include_files(gdbm.h HAVE_GDBM_H)
424 check_library_exists(gdbm gdbm_open "" HAVE_GDBM)
431 check_include_files(libmemcached/memcached.h HAVE_LIBMEMCACHED_MEMCACHED_H)
432 check_library_exists(memcached memcached "" HAVE_LIBMEMCACHED)
433 if(HAVE_LIBMEMCACHED_MEMCACHED_H AND HAVE_LIBMEMCACHED)
436 message(FATAL_ERROR "didn't find libmemcached")
441 check_include_files(dlfcn.h HAVE_DLFCN_H)
447 check_library_exists(dl dlopen "" HAVE_LIBDL)
452 set(LIGHTTPD_VERSION_ID 10400)
453 set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
454 set(PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
460 if(NOT LIGHTTPD_MODULES_DIR)
461 set(LIGHTTPD_MODULES_DIR "lib${LIB_SUFFIX}/lighttpd")
465 set(LIGHTTPD_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIGHTTPD_MODULES_DIR}")
467 ## We use relative path in windows
468 set(LIGHTTPD_LIBRARY_DIR "lib")
471 ## Write out config.h
472 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
474 add_definitions(-DHAVE_CONFIG_H)
476 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
479 base64.c buffer.c log.c
481 http_chunk.c stream.c fdevent.c
482 stat_cache.c plugin.c joblist.c etag.c array.c
483 data_string.c data_count.c data_array.c
484 data_integer.c md5.c data_fastcgi.c
486 fdevent_select.c fdevent_libev.c
487 fdevent_poll.c fdevent_linux_sysepoll.c
488 fdevent_solaris_devpoll.c fdevent_solaris_port.c
489 fdevent_freebsd_kqueue.c
491 inet_ntop_cache.c crc32.c
495 splaytree.c network_writev.c
496 network_write_mmap.c network_write_no_mmap.c
497 network_write.c network_linux_sendfile.c
498 network_freebsd_sendfile.c
499 network_solaris_sendfilev.c network_openssl.c
500 status_counter.c safe_memclear.c network_darwin_sendfile.c
504 message(STATUS "Adding local getopt implementation.")
505 set(COMMON_SRC ${COMMON_SRC} xgetopt.c)
508 add_executable(lemon lemon.c)
510 ## Build parsers by using lemon...
511 lemon_parser(configparser.y)
512 lemon_parser(mod_ssi_exprparser.y)
514 set(L_INSTALL_TARGETS)
516 add_executable(lighttpd-angel lighttpd-angel.c)
517 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel)
518 add_target_properties(lighttpd-angel COMPILE_FLAGS "-DSBIN_DIR=\\\\\"${CMAKE_INSTALL_PREFIX}/${SBINDIR}\\\\\"")
520 add_executable(lighttpd
531 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
533 add_and_install_library(mod_access mod_access.c)
534 add_and_install_library(mod_accesslog mod_accesslog.c)
535 add_and_install_library(mod_alias mod_alias.c)
536 add_and_install_library(mod_auth "mod_auth.c;http_auth.c")
538 add_and_install_library(mod_cgi mod_cgi.c)
540 add_and_install_library(mod_cml "mod_cml.c;mod_cml_lua.c;mod_cml_funcs.c")
541 add_and_install_library(mod_compress mod_compress.c)
542 add_and_install_library(mod_dirlisting mod_dirlisting.c)
543 add_and_install_library(mod_evasive mod_evasive.c)
544 add_and_install_library(mod_evhost mod_evhost.c)
545 add_and_install_library(mod_expire mod_expire.c)
546 add_and_install_library(mod_extforward mod_extforward.c)
547 add_and_install_library(mod_fastcgi mod_fastcgi.c)
548 add_and_install_library(mod_flv_streaming mod_flv_streaming.c)
549 add_and_install_library(mod_indexfile mod_indexfile.c)
550 add_and_install_library(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
551 add_and_install_library(mod_mysql_vhost mod_mysql_vhost.c)
552 add_and_install_library(mod_proxy mod_proxy.c)
553 add_and_install_library(mod_redirect mod_redirect.c)
554 add_and_install_library(mod_rewrite mod_rewrite.c)
555 add_and_install_library(mod_rrdtool mod_rrdtool.c)
556 add_and_install_library(mod_scgi mod_scgi.c)
557 add_and_install_library(mod_secdownload mod_secdownload.c)
558 add_and_install_library(mod_setenv mod_setenv.c)
559 add_and_install_library(mod_simple_vhost mod_simple_vhost.c)
560 add_and_install_library(mod_ssi "mod_ssi_exprparser.c;mod_ssi_expr.c;mod_ssi.c")
561 add_and_install_library(mod_staticfile mod_staticfile.c)
562 add_and_install_library(mod_status mod_status.c)
563 add_and_install_library(mod_trigger_b4_dl mod_trigger_b4_dl.c)
564 # add_and_install_library(mod_uploadprogress mod_uploadprogress.c)
565 add_and_install_library(mod_userdir mod_userdir.c)
566 add_and_install_library(mod_usertrack mod_usertrack.c)
567 add_and_install_library(mod_webdav mod_webdav.c)
569 add_executable(test_buffer
573 add_test(NAME test_buffer COMMAND test_buffer)
575 add_executable(test_base64
580 add_test(NAME test_base64 COMMAND test_base64)
582 add_executable(test_configfile
590 add_test(NAME test_configfile COMMAND test_configfile)
593 target_link_libraries(lighttpd ${PCRE_LDFLAGS})
594 add_target_properties(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS})
595 target_link_libraries(mod_rewrite ${PCRE_LDFLAGS})
596 add_target_properties(mod_rewrite COMPILE_FLAGS ${PCRE_CFLAGS})
597 target_link_libraries(mod_dirlisting ${PCRE_LDFLAGS})
598 add_target_properties(mod_dirlisting COMPILE_FLAGS ${PCRE_CFLAGS})
599 target_link_libraries(mod_redirect ${PCRE_LDFLAGS})
600 add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
601 target_link_libraries(mod_ssi ${PCRE_LDFLAGS})
602 add_target_properties(mod_ssi COMPILE_FLAGS ${PCRE_CFLAGS})
603 target_link_libraries(mod_trigger_b4_dl ${PCRE_LDFLAGS})
604 add_target_properties(mod_trigger_b4_dl COMPILE_FLAGS ${PCRE_CFLAGS})
607 target_link_libraries(mod_magnet ${LUA_LDFLAGS})
608 add_target_properties(mod_magnet COMPILE_FLAGS ${LUA_CFLAGS})
610 target_link_libraries(mod_cml ${LUA_LDFLAGS})
611 add_target_properties(mod_cml COMPILE_FLAGS ${LUA_CFLAGS})
613 if(HAVE_MYSQL_H AND HAVE_MYSQL)
614 target_link_libraries(mod_mysql_vhost mysqlclient)
615 include_directories(/usr/include/mysql)
620 set(L_MOD_WEBDAV ${L_MOD_WEBDAV} sqlite3)
623 target_link_libraries(mod_webdav ${XML2_LDFLAGS})
627 set(L_MOD_WEBDAV ${L_MOD_WEBDAV} uuid)
631 target_link_libraries(mod_webdav ${L_MOD_WEBDAV})
635 set(L_MOD_AUTH ${L_MOD_AUTH} crypt)
639 set(L_MOD_AUTH ${L_MOD_AUTH} ldap lber)
641 target_link_libraries(mod_auth ${L_MOD_AUTH})
645 target_link_libraries(mod_compress ${ZLIB_LIBRARY} bz2)
647 target_link_libraries(mod_compress ${ZLIB_LIBRARY})
652 target_link_libraries(lighttpd fam)
656 target_link_libraries(mod_trigger_b4_dl gdbm)
660 target_link_libraries(mod_trigger_b4_dl memcached)
663 if(CMAKE_COMPILER_IS_GNUCC)
664 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic ${WARN_CFLAGS}")
665 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
666 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
667 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2")
668 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
669 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WARN_LDFLAGS}")
670 add_definitions(-D_GNU_SOURCE)
673 add_target_properties(lighttpd LINK_FLAGS "-Wl,-export-dynamic")
675 set_target_properties(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
678 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVALGRIND")
679 add_target_properties(lighttpd COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
680 target_link_libraries(lighttpd ws2_32)
681 target_link_libraries(mod_proxy ws2_32)
682 target_link_libraries(mod_fcgi ws2_32)
683 target_link_libraries(mod_scgi ws2_32)
684 target_link_libraries(mod_ssi ws2_32)
687 target_link_libraries(lighttpd msvcr70)
688 add_target_properties(lighttpd LINK_FLAGS "-Wl,-subsystem,console")
694 target_link_libraries(lighttpd dl)
698 if(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
699 target_link_libraries(lighttpd ssl)
700 target_link_libraries(lighttpd crypto)
704 target_link_libraries(lighttpd ${LIBEV_LDFLAGS})
705 add_target_properties(lighttpd COMPILE_FLAGS ${LIBEV_CFLAGS})
709 target_link_libraries(lighttpd ${LIBUNWIND_LDFLAGS})
710 add_target_properties(lighttpd COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
712 target_link_libraries(test_buffer ${LIBUNWIND_LDFLAGS})
713 add_target_properties(test_buffer COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
714 target_link_libraries(test_base64 ${LIBUNWIND_LDFLAGS})
715 add_target_properties(test_base64 COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
716 target_link_libraries(test_configfile ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
717 add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
721 install(TARGETS ${L_INSTALL_TARGETS}
722 RUNTIME DESTINATION ${SBINDIR}
723 LIBRARY DESTINATION ${LIGHTTPD_MODULES_DIR}
724 ARCHIVE DESTINATION ${LIGHTTPD_MODULES_DIR}/static)
726 ## HACK to make win32 to install our libraries in desired directory..
727 install(TARGETS lighttpd
728 RUNTIME DESTINATION ${SBINDIR}
729 ARCHIVE DESTINATION lib/static)
730 list(REMOVE_ITEM L_INSTALL_TARGETS lighttpd)
731 install(TARGETS ${L_INSTALL_TARGETS}
732 RUNTIME DESTINATION ${SBINDIR}/lib
733 LIBRARY DESTINATION lib
734 ARCHIVE DESTINATION lib/static)