3 # Experimental cmake-based build support for Apache httpd on Windows
6 # 0. Read the todos down below and make sure this is good enough for your
8 # 1. cd to a clean directory for building (i.e., don't build in your
10 # 2. cmake -G "some backend, like 'NMake Makefiles'" \
11 # -DCMAKE_INSTALL_PREFIX=d:/path/to/httpdinst \
12 # -DPCRE_INCLUDE_DIR=d:/path/to/pcreinst/include \
13 # -DPCRE_LIBRARIES=d:/path/to/pcreinst/lib/pcre[d].lib \
14 # -DAPR_INCLUDE_DIR=d:/path/to/aprinst/include \
15 # -DAPR_LIBRARIES=d:/path/to/aprinst/lib/libapr2.lib \
16 # -DENABLE_MOD_foo="A|I|O" \
17 # d:/path/to/httpdsource
18 # Alternately, use cmake-gui and update settings in the GUI.
20 # Other flags of interest:
21 # CMAKE_C_FLAGS_RELEASE, _DEBUG, _RELWITHDEBINFO, _MINSIZEREL
23 # For NMake Makefiles the choices are at least DEBUG, RELEASE,
24 # RELWITHDEBINFO, and MINSIZEREL
25 # Other backends make have other selections.
26 # 3. build using chosen backend (e.g., "nmake install")
28 # PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES:
29 # cmake doesn't bundle FindXXX for these packages, so the crucial
30 # information has to be specified in this manner
33 # Each module has a default setting which can be overridden with one of the
35 # A build and Activate module
36 # I build module but leave it Inactive (commented-out LoadModule)
37 # O Omit module completely
38 # Example: -DENABLE_MOD_ALLOWHANDLERS="O" (Omit the module)
40 # Todos for Windows build:
41 # . Support APR 1.x in addition to APR trunk
42 # . Handling of module prerequisites
43 # . Find support libraries:
44 # + "Find" PCRE and APR (no bundled cmake FindXXX macros)
45 # + LUA, libxml2, distcache
46 # . Modules not yet supported:
47 # + mod_ldap, mod_authnz_ldap, mod_socache_dc, mod_proxy_html, mod_xml2enc,
48 # mod_lua, mod_serf, apreq+mod_apreq, mod_session_crypto
49 # + mod_lbmethod_rr and mod_firehose, which don't compile on Windows
50 # . Add a way to configure additional statically-linked modules (like --with-module on Unix)
51 # . Build buildmark.c when httpd.exe is regenerated
52 # . ab + HAVE_OPENSSL isn't working at all, even for plain
53 # . ApacheMonitor has a build error
54 # . install/customize .conf files
55 # . install docroot and CGI examples
56 # . install .h fils that are in odd places
57 # . Generally: go through the existing Windows build and see what is missing, whether a
58 # feature or some build nuance
60 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
65 # Options for support libraries not supported by cmake-bundled FindFOO
66 SET(APR_INCLUDE_DIR "C:/APR/include" CACHE STRING "Directory with APR[-Util] include files")
67 SET(APR_LIBRARIES "C:/APR/lib/libapr-2.lib" CACHE STRING "APR libraries to link with")
68 SET(PCRE_INCLUDE_DIR "C:/PCRE/include" CACHE STRING "Directory with PCRE include files")
69 SET(PCRE_LIBRARIES "C:/PCRE/lib/pcred.lib" CACHE STRING "PCRE libraries to link with")
70 # end support library configuration
72 # Options for each available module
73 # "A" ("A"ctive) means installed and active in default .conf, fail if can't be built
74 # "I" ("I"nactive) means installed and inactive (LoadModule commented out) in default .conf, fail if can't be built
75 # "O" ("O"mit) means not installed, no LoadModule
76 # "a" - like "A", but ignore with a warning if any prereqs aren't available
77 # "i" - like "I", but ignore with a warning if any prereqs aren't available
80 "modules/aaa/mod_access_compat.c+A+mod_access compatibility"
81 "modules/aaa/mod_allowhandlers.c+I+restrict allowed handlers"
82 "modules/aaa/mod_allowmethods.c+I+restrict allowed HTTP methods"
83 "modules/aaa/mod_auth_basic.c+A+basic authentication"
84 "modules/aaa/mod_auth_digest.c+I+RFC2617 Digest authentication"
85 "modules/aaa/mod_auth_form.c+I+form authentication"
86 "modules/aaa/mod_authn_anon.c+A+anonymous user authentication control"
87 "modules/aaa/mod_authn_core.c+A+core authentication module"
88 "modules/aaa/mod_authn_dbd.c+I+SQL-based authentication control"
89 "modules/aaa/mod_authn_dbm.c+I+DBM-based authentication control"
90 "modules/aaa/mod_authn_file.c+A+file-based authentication control"
91 "modules/aaa/mod_authn_socache.c+A+Cached authentication control"
92 "modules/aaa/mod_authnz_fcgi.c+I+FastCGI authorizer-based authentication and authorization"
93 "modules/aaa/mod_authnz_ldap.c+O+LDAP based authentication"
94 "modules/aaa/mod_authz_core.c+A+core authorization provider vector module"
95 "modules/aaa/mod_authz_dbd.c+I+SQL based authorization and Login/Session support"
96 "modules/aaa/mod_authz_dbm.c+I+DBM-based authorization control"
97 "modules/aaa/mod_authz_groupfile.c+A+'require group' authorization control"
98 "modules/aaa/mod_authz_host.c+A+host-based authorization control"
99 "modules/aaa/mod_authz_owner.c+I+'require file-owner' authorization control"
100 "modules/aaa/mod_authz_user.c+I+'require user' authorization control"
101 "modules/arch/win32/mod_isapi.c+I+isapi extension support"
102 "modules/cache/mod_cache.c+I+dynamic file caching. At least one storage management module (e.g. mod_cache_disk) is also necessary."
103 "modules/cache/mod_cache_disk.c+I+disk caching module"
104 "modules/cache/mod_cache_socache.c+A+shared object caching module"
105 "modules/cache/mod_file_cache.c+A+File cache"
106 "modules/cache/mod_socache_dbm.c+I+dbm small object cache provider"
107 "modules/cache/mod_socache_dc.c+O+distcache small object cache provider"
108 "modules/cache/mod_socache_memcache.c+I+memcache small object cache provider"
109 "modules/cache/mod_socache_shmcb.c+A+ shmcb small object cache provider"
110 "modules/cluster/mod_heartbeat.c+I+Generates Heartbeats"
111 "modules/cluster/mod_heartmonitor.c+I+Collects Heartbeats"
112 "modules/core/mod_macro.c+I+Define and use macros in configuration files"
113 "modules/core/mod_watchdog.c+I+Watchdog module"
114 "modules/database/mod_dbd.c+I+Apache DBD Framework"
115 "modules/dav/fs/mod_dav_fs.c+I+DAV provider for the filesystem."
116 "modules/dav/lock/mod_dav_lock.c+I+DAV provider for generic locking"
117 "modules/dav/main/mod_dav.c+I+WebDAV protocol handling."
118 "modules/debugging/mod_bucketeer.c+I+buckets manipulation filter. Useful only for developers and testing purposes."
119 "modules/debugging/mod_dumpio.c+I+I/O dump filter"
120 "modules/debugging/mod_firehose.c+O+Firehose dump filter"
121 "modules/echo/mod_echo.c+I+ECHO server"
122 "modules/examples/mod_case_filter.c+I+Example uppercase conversion filter"
123 "modules/examples/mod_case_filter_in.c+I+Example uppercase conversion input filter"
124 "modules/examples/mod_example_hooks.c+I+Example hook callback handler module"
125 "modules/examples/mod_example_ipc.c+I+Example of shared memory and mutex usage"
126 "modules/filters/mod_buffer.c+A+Filter Buffering"
127 "modules/filters/mod_charset_lite.c+O+character set translation"
128 "modules/filters/mod_data.c+I+RFC2397 data encoder"
129 "modules/filters/mod_deflate.c+i+Deflate transfer encoding support"
130 "modules/filters/mod_ext_filter.c+I+external filter module"
131 "modules/filters/mod_filter.c+A+Smart Filtering"
132 "modules/filters/mod_include.c+A+Server Side Includes"
133 "modules/filters/mod_proxy_html.c+O+Fix HTML Links in a Reverse Proxy"
134 "modules/filters/mod_ratelimit.c+I+Output Bandwidth Limiting"
135 "modules/filters/mod_reflector.c+I+Reflect request through the output filter stack"
136 "modules/filters/mod_reqtimeout.c+A+Limit time waiting for request from client"
137 "modules/filters/mod_request.c+I+Request Body Filtering"
138 "modules/filters/mod_sed.c+I+filter request and/or response bodies through sed"
139 "modules/filters/mod_substitute.c+I+response content rewrite-like filtering"
140 "modules/filters/mod_xml2enc.c+O+i18n support for markup filters"
141 "modules/generators/mod_asis.c+A+as-is filetypes"
142 "modules/generators/mod_autoindex.c+A+directory listing"
143 "modules/generators/mod_cgi.c+A+CGI scripts"
144 "modules/generators/mod_info.c+A+server information"
145 "modules/generators/mod_status.c+A+process/thread monitoring"
146 "modules/http/mod_mime.c+A+mapping of file-extension to MIME. Disabling this module is normally not recommended."
147 "modules/ldap/mod_ldap.c+O+LDAP caching and connection pooling services"
148 "modules/loggers/mod_log_config.c+A+logging configuration. You won't be able to log requests to the server without this module."
149 "modules/loggers/mod_log_debug.c+A+configurable debug logging"
150 "modules/loggers/mod_log_forensic.c+I+forensic logging"
151 "modules/loggers/mod_logio.c+I+input and output logging"
152 "modules/lua/mod_lua.c+O+Apache Lua Framework"
153 "modules/mappers/mod_actions.c+A+Action triggering on requests"
154 "modules/mappers/mod_alias.c+A+mapping of requests to different filesystem parts"
155 "modules/mappers/mod_dir.c+A+directory request handling"
156 "modules/mappers/mod_imagemap.c+I+server-side imagemaps"
157 "modules/mappers/mod_negotiation.c+A+content negotiation"
158 "modules/mappers/mod_rewrite.c+A+rule based URL manipulation"
159 "modules/mappers/mod_speling.c+A+correct common URL misspellings"
160 "modules/mappers/mod_userdir.c+A+mapping of requests to user-specific directories"
161 "modules/mappers/mod_vhost_alias.c+I+mass virtual hosting module"
162 "modules/metadata/mod_cern_meta.c+I+CERN-type meta files"
163 "modules/metadata/mod_env.c+A+clearing/setting of ENV vars"
164 "modules/metadata/mod_expires.c+A+Expires header control"
165 "modules/metadata/mod_headers.c+A+HTTP header control"
166 "modules/metadata/mod_ident.c+I+RFC 1413 identity check"
167 "modules/metadata/mod_mime_magic.c+I+automagically determining MIME type"
168 "modules/metadata/mod_remoteip.c+A+translate header contents to an apparent client remote_ip"
169 "modules/metadata/mod_setenvif.c+A+basing ENV vars on headers"
170 "modules/metadata/mod_unique_id.c+A+per-request unique ids"
171 "modules/metadata/mod_usertrack.c+A+user-session tracking"
172 "modules/metadata/mod_version.c+A+determining httpd version in config files"
173 "modules/proxy/balancers/mod_lbmethod_bybusyness.c+A+Apache proxy Load balancing by busyness"
174 "modules/proxy/balancers/mod_lbmethod_byrequests.c+A+Apache proxy Load balancing by request counting"
175 "modules/proxy/balancers/mod_lbmethod_bytraffic.c+A+Apache proxy Load balancing by traffic counting"
176 "modules/proxy/balancers/mod_lbmethod_heartbeat.c+A+Apache proxy Load balancing from Heartbeats"
177 "modules/proxy/mod_proxy_ajp.c+I+Apache proxy AJP module. Requires and is enabled by --enable-proxy."
178 "modules/proxy/mod_proxy_balancer.c+A+Apache proxy BALANCER module. Requires and is enabled by --enable-proxy."
179 "modules/proxy/mod_proxy.c+A+Apache proxy module"
180 "modules/proxy/mod_proxy_connect.c+I+Apache proxy CONNECT module. Requires and is enabled by --enable-proxy."
181 "modules/proxy/mod_proxy_express.c+I+mass reverse-proxy module. Requires --enable-proxy."
182 "modules/proxy/mod_proxy_fcgi.c+I+Apache proxy FastCGI module. Requires and is enabled by --enable-proxy."
183 "modules/proxy/mod_proxy_ftp.c+I+Apache proxy FTP module. Requires and is enabled by --enable-proxy."
184 "modules/proxy/mod_proxy_http.c+A+Apache proxy HTTP module. Requires and is enabled by --enable-proxy."
185 "modules/proxy/mod_proxy_scgi.c+I+Apache proxy SCGI module. Requires and is enabled by --enable-proxy."
186 "modules/proxy/mod_proxy_wstunnel.c+I+Apache proxy Websocket Tunnel module. Requires and is enabled by --enable-proxy."
187 "modules/proxy/mod_serf.c+O+Reverse proxy module using Serf"
188 "modules/session/mod_session.c+I+session module"
189 "modules/session/mod_session_cookie.c+I+session cookie module"
190 "modules/session/mod_session_crypto.c+O+session crypto module"
191 "modules/session/mod_session_dbd.c+I+session dbd module"
192 "modules/slotmem/mod_slotmem_plain.c+A+slotmem provider that uses plain memory"
193 "modules/slotmem/mod_slotmem_shm.c+A+slotmem provider that uses shared memory"
194 "modules/ssl/mod_ssl.c+i+SSL/TLS support"
195 "modules/test/mod_dialup.c+I+rate limits static files to dialup modem speeds"
196 "modules/test/mod_optional_fn_export.c+I+example optional function exporter"
197 "modules/test/mod_optional_fn_import.c+I+example optional function importer"
198 "modules/test/mod_optional_hook_export.c+I+example optional hook exporter"
199 "modules/test/mod_optional_hook_import.c+I+example optional hook importer"
200 "modules/test/mod_policy.c+I+HTTP protocol compliance filters"
203 # Define extra definitions, sources, headers, etc. required by some modules.
204 # This could be included in the master list of modules above, though it
205 # certainly would get a lot more unreadable.
206 SET(mod_authz_dbd_extra_defines AUTHZ_DBD_DECLARE_EXPORT)
207 SET(mod_cache_extra_defines CACHE_DECLARE_EXPORT)
208 SET(mod_cache_extra_sources
209 modules/cache/cache_storage.c modules/cache/cache_util.c
211 SET(mod_cache_disk_extra_libs mod_cache)
212 SET(mod_cache_socache_extra_libs mod_cache)
213 SET(mod_dav_extra_defines DAV_DECLARE_EXPORT)
214 SET(mod_dav_extra_sources
215 modules/dav/main/liveprop.c modules/dav/main/props.c
216 modules/dav/main/std_liveprop.c modules/dav/main/providers.c
217 modules/dav/main/util.c modules/dav/main/util_lock.c
219 SET(mod_dav_fs_extra_sources
220 modules/dav/fs/dbm.c modules/dav/fs/lock.c
221 modules/dav/fs/repos.c
223 SET(mod_dav_fs_extra_libs mod_dav)
224 SET(mod_dav_lock_extra_sources modules/dav/lock/locks.c)
225 SET(mod_dav_lock_extra_libs mod_dav)
226 SET(mod_dbd_extra_defines DBD_DECLARE_EXPORT)
227 SET(mod_deflate_requires ZLIB_FOUND)
228 SET(mod_deflate_extra_includes ${ZLIB_INCLUDE_DIR})
229 SET(mod_deflate_extra_libs ${ZLIB_LIBRARIES})
230 SET(mod_heartbeat_extra_libs mod_watchdog)
231 SET(mod_optional_hook_export_extra_defines AP_DECLARE_EXPORT) # bogus reuse of core API prefix
232 SET(mod_proxy_extra_defines PROXY_DECLARE_EXPORT)
233 SET(mod_proxy_extra_sources modules/proxy/proxy_util.c)
234 SET(mod_proxy_ajp_extra_sources
235 modules/proxy/ajp_header.c modules/proxy/ajp_link.c
236 modules/proxy/ajp_msg.c modules/proxy/ajp_utils.c
238 SET(mod_proxy_ajp_extra_libs mod_proxy)
239 SET(mod_proxy_balancer_extra_libs mod_proxy)
240 SET(mod_proxy_connect_extra_libs mod_proxy)
241 SET(mod_proxy_express_extra_libs mod_proxy)
242 SET(mod_proxy_fcgi_extra_libs mod_proxy)
243 SET(mod_proxy_ftp_extra_libs mod_proxy)
244 SET(mod_proxy_http_extra_libs mod_proxy)
245 SET(mod_proxy_scgi_extra_libs mod_proxy)
246 SET(mod_proxy_wstunnel_extra_libs mod_proxy)
247 SET(mod_ratelimit_extra_defines AP_RL_DECLARE_EXPORT)
248 SET(mod_sed_extra_sources
249 modules/filters/regexp.c modules/filters/sed0.c
250 modules/filters/sed1.c
252 SET(mod_session_extra_defines SESSION_DECLARE_EXPORT)
253 SET(mod_session_cookie_extra_libs mod_session)
254 SET(mod_session_dbd_extra_libs mod_session)
255 SET(mod_ssl_requires OPENSSL_FOUND)
256 SET(mod_ssl_extra_includes ${OPENSSL_INCLUDE_DIR})
257 SET(mod_ssl_extra_sources
258 modules/ssl/ssl_engine_config.c modules/ssl/ssl_engine_dh.c
259 modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c
260 modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_engine_log.c
261 modules/ssl/ssl_engine_mutex.c modules/ssl/ssl_engine_ocsp.c
262 modules/ssl/ssl_engine_pphrase.c modules/ssl/ssl_engine_rand.c
263 modules/ssl/ssl_engine_vars.c modules/ssl/ssl_scache.c
264 modules/ssl/ssl_util.c modules/ssl/ssl_util_ocsp.c
265 modules/ssl/ssl_util_ssl.c modules/ssl/ssl_util_stapling.c
267 SET(mod_ssl_extra_libs ${OPENSSL_LIBRARIES})
268 SET(mod_status_extra_defines STATUS_DECLARE_EXPORT)
269 SET(mod_watchdog_extra_defines AP_WD_DECLARE_EXPORT)
273 SET(moduleselections)
274 FOREACH (modinfo ${MODULE_LIST})
275 STRING(REGEX REPLACE "([^+]*)\\+([^+]*)\\+([^+]*)" "\\1;\\2;\\3" modinfolist ${modinfo})
276 LIST(LENGTH modinfolist modinfolen)
277 SET(primarysourcefile)
280 FOREACH(i ${modinfolist})
281 IF("${primarysourcefile}" STREQUAL "")
282 SET(primarysourcefile ${i})
283 ELSEIF("${defaultenable}" STREQUAL "")
284 SET(defaultenable ${i})
285 ELSEIF("${helptext}" STREQUAL "")
288 MESSAGE(FATAL_ERROR "Unexpected field or plus sign in >${modinfo}<")
292 # MESSAGE(" primary source file: ${primarysourcefile}")
293 # MESSAGE("enablement by default: ${defaultenable}")
294 # MESSAGE(" help text: ${helptext}")
296 STRING(REGEX MATCH "[^/]+\\.c" mod_basename ${primarysourcefile})
297 STRING(REGEX MATCH "[^.]+" mod_name ${mod_basename})
299 STRING(TOUPPER "ENABLE_${mod_name}" mod_option_name)
301 SET(${mod_option_name} ${defaultenable} CACHE STRING ${helptext})
302 SET(MODULE_SRCS "${MODULE_SRCS};${primarysourcefile}")
303 SET(moduleselections "${moduleselections};${mod_option_name}")
308 SET(install_modules) # special handling vs. other installed targets
310 ADD_EXECUTABLE(gen_test_char server/gen_test_char.c)
311 GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION)
313 COMMENT "Generating character tables, test_char.h, for current locale"
314 DEPENDS gen_test_char
315 COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/test_char.h
316 OUTPUT ${PROJECT_BINARY_DIR}/test_char.h
320 DEPENDS ${PROJECT_BINARY_DIR}/test_char.h
323 SET(HTTPD_MAIN_SOURCES
328 modules/arch/win32/mod_win32.c
329 modules/core/mod_so.c
330 modules/http/byterange_filter.c
331 modules/http/chunk_filter.c
332 modules/http/http_core.c
333 modules/http/http_etag.c
334 modules/http/http_filters.c
335 modules/http/http_protocol.c
336 modules/http/http_request.c
339 os/win32/util_win32.c
344 server/core_filters.c
347 server/error_bucket.c
350 server/mpm/winnt/child.c
351 server/mpm/winnt/mpm_winnt.c
352 server/mpm/winnt/nt_eventlog.c
353 server/mpm/winnt/service.c
360 server/util_cfgtree.c
361 server/util_cookies.c
362 server/util_expr_eval.c
363 server/util_expr_parse.c
364 server/util_expr_scan.c
377 CONFIGURE_FILE(os/win32/win32_config_layout.h
378 ${PROJECT_BINARY_DIR}/ap_config_layout.h)
380 SET(HTTPD_INCLUDE_DIRECTORIES
381 ${PROJECT_BINARY_DIR}
382 # see discussion in cmake bug 13188 regarding oddities with relative paths
383 ${CMAKE_CURRENT_SOURCE_DIR}/include
384 ${CMAKE_CURRENT_SOURCE_DIR}/os/win32
385 ${CMAKE_CURRENT_SOURCE_DIR}/modules/core
386 ${CMAKE_CURRENT_SOURCE_DIR}/modules/database
387 ${CMAKE_CURRENT_SOURCE_DIR}/modules/dav/main
388 ${CMAKE_CURRENT_SOURCE_DIR}/modules/filters
389 ${CMAKE_CURRENT_SOURCE_DIR}/modules/generators
390 ${CMAKE_CURRENT_SOURCE_DIR}/modules/proxy
391 ${CMAKE_CURRENT_SOURCE_DIR}/modules/session
392 ${CMAKE_CURRENT_SOURCE_DIR}/modules/ssl
393 ${CMAKE_CURRENT_SOURCE_DIR}/server
395 ${APR_PRIVATE_INCLUDE_DIRS}
399 INCLUDE_DIRECTORIES(${HTTPD_INCLUDE_DIRECTORIES})
401 SET(HTTPD_SYSTEM_LIBS
406 ########### HTTPD MODULES ############
408 FOREACH (mod ${MODULE_SRCS})
409 # Build different forms of the module name; e.g.,
410 # mod_short_name->mod_cgi.c, mod_name->mod_cgi, mod_module_name->cgi_module
411 STRING(REGEX MATCH "[^/]+\\.c" mod_basename ${mod})
412 STRING(REGEX MATCH "[^.]+" mod_name ${mod_basename})
413 STRING(REGEX REPLACE "^mod_(.*)" "\\1_module" mod_module_name ${mod_name})
416 STRING(TOUPPER "ENABLE_${mod_name}" enable_mod)
417 SET(enable_mod_val ${${enable_mod}})
419 IF(NOT ${enable_mod_val} STREQUAL "O") # build of module is desired
420 SET(mod_requires "${mod_name}_requires")
421 STRING(TOUPPER ${enable_mod_val} enable_mod_val_upper)
422 IF(NOT ${${mod_requires}} STREQUAL "") # module has some prerequisite
423 IF(NOT ${${mod_requires}}) # prerequisite doesn't exist
424 IF(NOT ${enable_mod_val} STREQUAL ${enable_mod_val_upper}) # lower case, so optional based on prereq
425 MESSAGE(STATUS "${mod_name} was requested but couldn't be built due to a missing prerequisite (${${mod_requires}})")
426 ELSE() # must be upper case "A" or "I" (or coding error above)
427 MESSAGE(FATAL_ERROR "${mod_name} was requested but couldn't be built due to a missing prerequisite (${${mod_requires}})")
431 # map a->A, i->I for remaining logic since prereq checking is over
432 SET(enable_mod_val ${enable_mod_val_upper})
435 IF(${enable_mod_val} STREQUAL "O")
438 # Handle whether or not the LoadModule is commented out.
439 IF(${enable_mod_val} STREQUAL "A")
440 SET(LoadModules ${LoadModules} "LoadModule ${mod_module_name} modules/${mod_name}.so\n")
441 ELSEIF(${enable_mod_val} STREQUAL "I")
442 SET(LoadModules ${LoadModules} "# LoadModule ${mod_module_name} modules/${mod_name}.so\n")
444 MESSAGE(FATAL_ERROR "${enable_mod} must be set to \"A\", \"I\", or \"O\" instead of \"${enable_mod_val}\"")
447 # Handle building it.
448 SET(mod_extra_sources "${mod_name}_extra_sources")
449 SET(all_mod_sources ${mod} ${${mod_extra_sources}})
450 ADD_LIBRARY(${mod_name} SHARED ${all_mod_sources})
451 SET(install_modules ${install_modules} ${mod_name})
452 SET(mod_extra_libs "${mod_name}_extra_libs")
453 SET_TARGET_PROPERTIES(${mod_name} PROPERTIES SUFFIX .so)
454 TARGET_LINK_LIBRARIES(${mod_name} ${${mod_extra_libs}} libhttpd ${APR_LIBRARIES} ${HTTPD_SYSTEM_LIBS})
457 SET(mod_extra_defines "${mod_name}_extra_defines")
458 IF(NOT ${${mod_extra_defines}} STREQUAL "")
459 SET_TARGET_PROPERTIES(${mod_name} PROPERTIES COMPILE_DEFINITIONS ${${mod_extra_defines}})
463 SET(mod_extra_includes "${mod_name}_extra_includes")
464 IF(NOT ${${mod_extra_includes}} STREQUAL "")
465 SET(tmp_includes ${${mod_extra_includes}} ${HTTPD_INCLUDE_DIRECTORIES})
466 SET_TARGET_PROPERTIES(${mod_name} PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}")
467 GET_PROPERTY(tmp_includes TARGET ${mod_name} PROPERTY INCLUDE_DIRECTORIES)
473 ########### HTTPD LIBRARIES ############
474 ADD_LIBRARY(libhttpd SHARED ${LIBHTTPD_SOURCES})
475 SET(install_targets ${install_targets} libhttpd)
476 TARGET_LINK_LIBRARIES(libhttpd ${APR_LIBRARIES} ${PCRE_LIBRARIES} ${HTTPD_SYSTEM_LIBS})
477 SET_TARGET_PROPERTIES(libhttpd PROPERTIES COMPILE_FLAGS -DAP_DECLARE_EXPORT)
478 ADD_DEPENDENCIES(libhttpd test_char_header)
480 ########### HTTPD EXECUTABLES ##########
481 ADD_EXECUTABLE(httpd server/main.c build/win32/httpd.rc)
482 SET(install_targets ${install_targets} httpd)
483 TARGET_LINK_LIBRARIES(httpd libhttpd)
485 ADD_EXECUTABLE(ab support/ab.c)
486 SET(install_targets ${install_targets} ab)
488 SET_TARGET_PROPERTIES(ab PROPERTIES COMPILE_DEFINITIONS HAVE_OPENSSL)
489 SET(tmp_includes ${HTTPD_INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_DIR})
490 SET_TARGET_PROPERTIES(ab PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}")
491 TARGET_LINK_LIBRARIES(ab ${APR_LIBRARIES} ${OPENSSL_LIBRARIES})
493 TARGET_LINK_LIBRARIES(ab ${APR_LIBRARIES})
495 GET_PROPERTY(tmp_includes TARGET ab PROPERTY INCLUDE_DIRECTORIES)
497 # getting duplicate manifest error with ApacheMonitor
498 # ADD_EXECUTABLE(ApacheMonitor support/win32/ApacheMonitor.c support/win32/ApacheMonitor.rc)
499 # SET(install_targets ${install_targets} ApacheMonitor)
500 # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE)
501 # TARGET_LINK_LIBRARIES(ApacheMonitor ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32)
503 ADD_EXECUTABLE(htcacheclean support/htcacheclean.c)
504 SET(install_targets ${install_targets} htcacheclean)
505 TARGET_LINK_LIBRARIES(htcacheclean ${APR_LIBRARIES})
507 ADD_EXECUTABLE(htdbm support/htdbm.c support/passwd_common.c)
508 SET(install_targets ${install_targets} htdbm)
509 TARGET_LINK_LIBRARIES(htdbm ${APR_LIBRARIES})
511 ADD_EXECUTABLE(htdigest support/htdigest.c)
512 SET(install_targets ${install_targets} htdigest)
513 TARGET_LINK_LIBRARIES(htdigest ${APR_LIBRARIES})
515 ADD_EXECUTABLE(htpasswd support/htpasswd.c support/passwd_common.c)
516 SET(install_targets ${install_targets} htpasswd)
517 TARGET_LINK_LIBRARIES(htpasswd ${APR_LIBRARIES})
519 ADD_EXECUTABLE(logresolve support/logresolve.c)
520 SET(install_targets ${install_targets} logresolve)
521 TARGET_LINK_LIBRARIES(logresolve ${APR_LIBRARIES})
523 ADD_EXECUTABLE(rotatelogs support/rotatelogs.c)
524 SET(install_targets ${install_targets} rotatelogs)
525 TARGET_LINK_LIBRARIES(rotatelogs ${APR_LIBRARIES})
527 INSTALL(TARGETS ${install_targets}
528 RUNTIME DESTINATION bin
529 LIBRARY DESTINATION lib
530 ARCHIVE DESTINATION lib
532 INSTALL(TARGETS ${install_modules}
533 RUNTIME DESTINATION modules
535 INSTALL(DIRECTORY include/ DESTINATION include
536 FILES_MATCHING PATTERN "*.h"
538 INSTALL(DIRECTORY docs/icons/ DESTINATION icons)
539 INSTALL(DIRECTORY docs/error/ DESTINATION error)
540 INSTALL(DIRECTORY docs/manual/ DESTINATION manual
541 FILES_MATCHING PATTERN "BUILDING" EXCLUDE
543 INSTALL(DIRECTORY DESTINATION logs)
544 INSTALL(DIRECTORY DESTINATION cgi-bin)
546 MESSAGE(STATUS "Module selections:")
547 FOREACH(modsel ${moduleselections})
548 MESSAGE(STATUS " ${modsel} ${${modsel}}")