]> granicus.if.org Git - apache/blob - CMakeLists.txt
r1678763 | ylavic | 2015-05-11 16:53:34 +0200 (Mon, 11 May 2015) | 7 lines
[apache] / CMakeLists.txt
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # Read README.cmake before using this.
17
18 PROJECT(HTTPD C)
19
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
21
22 INCLUDE(CheckSymbolExists)
23 INCLUDE(CheckCSourceCompiles)
24
25 FIND_PACKAGE(LibXml2)
26 FIND_PACKAGE(Lua51)
27 FIND_PACKAGE(OpenSSL)
28 FIND_PACKAGE(ZLIB)
29
30 # Options for support libraries not supported by cmake-bundled FindFOO
31
32 # Default to using APR trunk (libapr-2.lib) if it exists in PREFIX/lib;
33 # otherwise, default to APR 1.x + APR-util 1.x
34 IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
35   SET(default_apr_libraries "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
36 ELSEIF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib")
37   SET(ldaplib "${CMAKE_INSTALL_PREFIX}/lib/apr_ldap-1.lib")
38   IF(NOT EXISTS ${ldaplib})
39     SET(ldaplib)
40   ENDIF()
41   SET(default_apr_libraries ${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib ${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib ${ldaplib})
42 ELSE()
43   SET(default_apr_libraries)
44 ENDIF()
45
46 # PCRE names its libraries differently for debug vs. release builds.
47 # We can't query our own CMAKE_BUILD_TYPE at configure time.
48 # If the debug version exists in PREFIX/lib, default to that one.
49 IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/pcred.lib")
50   SET(default_pcre_libraries ${CMAKE_INSTALL_PREFIX}/lib/pcred.lib)
51 ELSE()
52   SET(default_pcre_libraries ${CMAKE_INSTALL_PREFIX}/lib/pcre.lib)
53 ENDIF()
54
55 IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
56   SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2d.lib")
57 ELSE()
58   SET(default_nghttp2_libraries "${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib")
59 ENDIF()
60
61 SET(APR_INCLUDE_DIR       "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with APR[-Util] include files")
62 SET(APR_LIBRARIES         ${default_apr_libraries}       CACHE STRING "APR libraries to link with")
63 SET(NGHTTP2_INCLUDE_DIR   "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with NGHTTP2 include files within nghttp2 subdirectory")
64 SET(NGHTTP2_LIBRARIES     ${default_nghttp2_libraries}   CACHE STRING "NGHTTP2 libraries to link with")
65 SET(PCRE_INCLUDE_DIR      "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with PCRE include files")
66 SET(PCRE_LIBRARIES        ${default_pcre_libraries}      CACHE STRING "PCRE libraries to link with")
67 SET(LIBXML2_ICONV_INCLUDE_DIR     ""                     CACHE STRING "Directory with iconv include files for libxml2")
68 SET(LIBXML2_ICONV_LIBRARIES       ""                     CACHE STRING "iconv libraries to link with for libxml2")
69 # end support library configuration
70
71 # Misc. options
72 OPTION(INSTALL_PDB        "Install .pdb files (if generated)"  ON)
73 OPTION(INSTALL_MANUAL     "Install manual"                     ON)
74
75 SET(ENABLE_MODULES        "O"                            CACHE STRING "Minimum module enablement (e.g., \"i\" to build all but those without prerequisites)")
76 SET(WITH_MODULES          ""                             CACHE STRING "comma-separated paths to single-file modules to statically link into the server")
77 SET(EXTRA_INCLUDES        ""                             CACHE STRING "Extra include directories")
78 SET(EXTRA_LIBS            ""                             CACHE STRING "Extra libraries")
79 SET(EXTRA_COMPILE_FLAGS   ""                             CACHE STRING "Extra compile flags")
80
81 IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h")
82   MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.")
83 ENDIF()
84 FOREACH(onelib ${APR_LIBRARIES})
85   IF(NOT EXISTS ${onelib})
86     MESSAGE(FATAL_ERROR "APR library ${onelib} was not found.")
87   ENDIF()
88 ENDFOREACH()
89
90 MACRO(DEFINE_WITH_BLANKS output_definition input_symbol input_value)
91   IF(MSVC_IDE OR ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.11)
92     SET(${output_definition} "-D${input_symbol}=\"${input_value}\"")
93   ELSE()
94     # command-line tool + older cmake, where extra quotes must be added and
95     # escaped to survive
96     SET(${output_definition} "-D${input_symbol}=\"\\\"${input_value}\\\"\"")
97   ENDIF()
98 ENDMACRO()
99
100 MACRO(GET_MOD_ENABLE_RANK macro_modname macro_mod_enable_val macro_output_rank)
101   IF(${macro_mod_enable_val} STREQUAL "O")
102     SET(${macro_output_rank} 0)
103   ELSEIF(${macro_mod_enable_val} STREQUAL "i")
104     SET(${macro_output_rank} 1)
105   ELSEIF(${macro_mod_enable_val} STREQUAL "I")
106     SET(${macro_output_rank} 2)
107   ELSEIF(${macro_mod_enable_val} STREQUAL "a")
108     SET(${macro_output_rank} 3)
109   ELSEIF(${macro_mod_enable_val} STREQUAL "A")
110     SET(${macro_output_rank} 4)
111   ELSE()
112     MESSAGE(FATAL_ERROR "Unexpected enablement value \"${macro_mod_enable_val}\" for ${macro_modname}")
113   ENDIF()
114 ENDMACRO()
115
116 GET_MOD_ENABLE_RANK("ENABLE_MODULES setting" ${ENABLE_MODULES} enable_modules_rank)
117
118 # Figure out what APR/APU features are available
119 #
120 # CHECK_APR_FEATURE checks for features defined to 1 or 0 in apr.h or apu.h
121 # The symbol representing the feature will be set to TRUE or FALSE for 
122 # compatibility with the feature tests set by FindFooPackage.
123 #
124 # (unclear why CHECK_SYMBOL_EXISTS is needed, but I was getting "found" for anything 
125 # not defined to either 1 or 0)
126
127 MACRO(CHECK_APR_FEATURE which_define)
128   CHECK_SYMBOL_EXISTS(${which_define} "${APR_INCLUDE_DIR}/apr.h;${APR_INCLUDE_DIR}/apu.h" tmp_${which_define})
129   IF(${tmp_${which_define}})
130     CHECK_C_SOURCE_COMPILES("#include \"${APR_INCLUDE_DIR}/apr.h\"
131       #include \"${APR_INCLUDE_DIR}/apu.h\"
132       int main() {
133       #ifndef ${which_define}
134       #error gobble
135       #endif
136       #if !${which_define}
137       #error gobble
138       #endif
139       return 1;}" ${which_define})
140   ELSE()
141     SET(${which_define})
142   ENDIF()
143   IF(${${which_define}})
144     SET(${which_define} TRUE)
145   ELSE()
146     SET(${which_define} FALSE)
147   ENDIF()
148 ENDMACRO()
149
150 CHECK_APR_FEATURE(APR_HAS_XLATE)
151 CHECK_APR_FEATURE(APU_HAVE_CRYPTO)
152
153 # APR_HAS_LDAP is defined in apr_ldap.h, which exists only in apr 1.x, so use
154 # special code instead of CHECK_APR_FEATURE()
155 # As with CHECK_APR_FEATURE(), convert to a TRUE/FALSE result.
156 CHECK_C_SOURCE_COMPILES("#include \"${APR_INCLUDE_DIR}/apr.h\"
157 #include \"${APR_INCLUDE_DIR}/apr_ldap.h\"
158 int main() {
159 #if !APR_HAS_LDAP
160 #error gobble
161 #endif
162 return 1;}" APR_HAS_LDAP)
163 IF(${APR_HAS_LDAP})
164   SET(APR_HAS_LDAP TRUE)
165 ELSE()
166   SET(APR_HAS_LDAP FALSE)
167 ENDIF()
168
169 # See if nghttp2 exists in a configured or defaulted location
170 SET(NGHTTP2_FOUND TRUE)
171 IF(EXISTS "${NGHTTP2_INCLUDE_DIR}/nghttp2/nghttp2.h")
172   FOREACH(onelib ${NGHTTP2_LIBRARIES})
173     IF(NOT EXISTS ${onelib})
174       SET(NGHTTP2_FOUND FALSE)
175     ENDIF()
176   ENDFOREACH()
177 ELSE()
178   SET(NGHTTP2_FOUND FALSE)
179 ENDIF()
180
181 MESSAGE(STATUS "")
182 MESSAGE(STATUS "Summary of feature detection:")
183 MESSAGE(STATUS "")
184 MESSAGE(STATUS "LIBXML2_FOUND ............ : ${LIBXML2_FOUND}")
185 MESSAGE(STATUS "LUA51_FOUND .............. : ${LUA51_FOUND}")
186 MESSAGE(STATUS "NGHTTP2_FOUND ............ : ${NGHTTP2_FOUND}")
187 MESSAGE(STATUS "OPENSSL_FOUND ............ : ${OPENSSL_FOUND}")
188 MESSAGE(STATUS "ZLIB_FOUND ............... : ${ZLIB_FOUND}")
189 MESSAGE(STATUS "APR_HAS_LDAP ............. : ${APR_HAS_LDAP}")
190 MESSAGE(STATUS "APR_HAS_XLATE ............ : ${APR_HAS_XLATE}")
191 MESSAGE(STATUS "APU_HAVE_CRYPTO .......... : ${APU_HAVE_CRYPTO}")
192 MESSAGE(STATUS "")
193
194 # Options for each available module
195 #   "A" ("A"ctive) means installed and active in default .conf, fail if can't be built
196 #   "I" ("I"nactive) means installed and inactive (LoadModule commented out) in default .conf, fail if can't be built
197 #   "O" ("O"mit) means not installed, no LoadModule
198 #   "a" - like "A", but ignore with a warning if any prereqs aren't available
199 #   "i" - like "I", but ignore with a warning if any prereqs aren't available
200
201 # Current heuristic for default enablement:
202 #
203 #   Module requires a prereq and           -> O
204 #   finding/usingprereq isn't implemented
205 #   yet
206 #
207 #   Module is included by default in       -> a if it has prereqs, A otherwise
208 #   autoconf-based build 
209 #
210 #   Module is included in                  -> i if it has prereqs, I otherwise
211 #   --enable-modules=most 
212 #
213 #   Otherwise                              -> O
214 #
215 SET(MODULE_LIST
216   "modules/aaa/mod_access_compat+A+mod_access compatibility"
217   "modules/aaa/mod_allowmethods+I+restrict allowed HTTP methods"
218   "modules/aaa/mod_auth_basic+A+basic authentication"
219   "modules/aaa/mod_auth_digest+I+RFC2617 Digest authentication"
220   "modules/aaa/mod_auth_form+I+form authentication"
221   "modules/aaa/mod_authn_anon+I+anonymous user authentication control"
222   "modules/aaa/mod_authn_core+A+core authentication module"
223   "modules/aaa/mod_authn_dbd+I+SQL-based authentication control"
224   "modules/aaa/mod_authn_dbm+I+DBM-based authentication control"
225   "modules/aaa/mod_authn_file+A+file-based authentication control"
226   "modules/aaa/mod_authn_socache+I+Cached authentication control"
227   "modules/aaa/mod_authnz_fcgi+I+FastCGI authorizer-based authentication and authorization"
228   "modules/aaa/mod_authnz_ldap+i+LDAP based authentication"
229   "modules/aaa/mod_authz_core+A+core authorization provider vector module"
230   "modules/aaa/mod_authz_dbd+I+SQL based authorization and Login/Session support"
231   "modules/aaa/mod_authz_dbm+I+DBM-based authorization control"
232   "modules/aaa/mod_authz_groupfile+A+'require group' authorization control"
233   "modules/aaa/mod_authz_host+A+host-based authorization control"
234   "modules/aaa/mod_authz_owner+I+'require file-owner' authorization control"
235   "modules/aaa/mod_authz_user+A+'require user' authorization control"
236   "modules/arch/win32/mod_isapi+I+isapi extension support"
237   "modules/cache/mod_cache+I+dynamic file caching.  At least one storage management module (e.g. mod_cache_disk) is also necessary."
238   "modules/cache/mod_cache_disk+I+disk caching module"
239   "modules/cache/mod_cache_socache+I+shared object caching module"
240   "modules/cache/mod_file_cache+I+File cache"
241   "modules/cache/mod_socache_dbm+I+dbm small object cache provider"
242   "modules/cache/mod_socache_dc+O+distcache small object cache provider"
243   "modules/cache/mod_socache_memcache+I+memcache small object cache provider"
244   "modules/cache/mod_socache_shmcb+I+ shmcb small object cache provider"
245   "modules/cluster/mod_heartbeat+I+Generates Heartbeats"
246   "modules/cluster/mod_heartmonitor+I+Collects Heartbeats"
247   "modules/core/mod_macro+I+Define and use macros in configuration files"
248   "modules/core/mod_watchdog+I+Watchdog module"
249   "modules/database/mod_dbd+I+Apache DBD Framework"
250   "modules/dav/fs/mod_dav_fs+I+DAV provider for the filesystem."
251   "modules/dav/lock/mod_dav_lock+I+DAV provider for generic locking"
252   "modules/dav/main/mod_dav+I+WebDAV protocol handling."
253   "modules/debugging/mod_bucketeer+O+buckets manipulation filter.  Useful only for developers and testing purposes."
254   "modules/debugging/mod_dumpio+I+I/O dump filter"
255   "modules/echo/mod_echo+O+ECHO server"
256   "modules/examples/mod_case_filter+O+Example uppercase conversion filter"
257   "modules/examples/mod_case_filter_in+O+Example uppercase conversion input filter"
258   "modules/examples/mod_example_hooks+O+Example hook callback handler module"
259   "modules/examples/mod_example_ipc+O+Example of shared memory and mutex usage"
260   "modules/filters/mod_buffer+I+Filter Buffering"
261   "modules/filters/mod_charset_lite+i+character set translation"
262   "modules/filters/mod_data+O+RFC2397 data encoder"
263   "modules/filters/mod_deflate+i+Deflate transfer encoding support"
264   "modules/filters/mod_ext_filter+I+external filter module"
265   "modules/filters/mod_filter+A+Smart Filtering"
266   "modules/filters/mod_include+I+Server Side Includes"
267   "modules/filters/mod_proxy_html+i+Fix HTML Links in a Reverse Proxy"
268   "modules/filters/mod_ratelimit+I+Output Bandwidth Limiting"
269   "modules/filters/mod_reflector+O+Reflect request through the output filter stack"
270   "modules/filters/mod_reqtimeout+A+Limit time waiting for request from client"
271   "modules/filters/mod_request+I+Request Body Filtering"
272   "modules/filters/mod_sed+I+filter request and/or response bodies through sed"
273   "modules/filters/mod_substitute+I+response content rewrite-like filtering"
274   "modules/filters/mod_xml2enc+i+i18n support for markup filters"
275   "modules/generators/mod_asis+I+as-is filetypes"
276   "modules/generators/mod_autoindex+A+directory listing"
277   "modules/generators/mod_cgi+I+CGI scripts"
278   "modules/generators/mod_info+I+server information"
279   "modules/generators/mod_status+I+process/thread monitoring"
280   "modules/http/mod_mime+A+mapping of file-extension to MIME.  Disabling this module is normally not recommended."
281   "modules/http2/mod_http2+i+HTTP/2 protocol support"
282   "modules/ldap/mod_ldap+i+LDAP caching and connection pooling services"
283   "modules/loggers/mod_log_config+A+logging configuration.  You won't be able to log requests to the server without this module."
284   "modules/loggers/mod_log_debug+I+configurable debug logging"
285   "modules/loggers/mod_log_forensic+I+forensic logging"
286   "modules/loggers/mod_logio+I+input and output logging"
287   "modules/lua/mod_lua+i+Apache Lua Framework"
288   "modules/mappers/mod_actions+I+Action triggering on requests"
289   "modules/mappers/mod_alias+A+mapping of requests to different filesystem parts"
290   "modules/mappers/mod_dir+A+directory request handling"
291   "modules/mappers/mod_imagemap+I+server-side imagemaps"
292   "modules/mappers/mod_negotiation+I+content negotiation"
293   "modules/mappers/mod_rewrite+I+rule based URL manipulation"
294   "modules/mappers/mod_speling+I+correct common URL misspellings"
295   "modules/mappers/mod_userdir+I+mapping of requests to user-specific directories"
296   "modules/mappers/mod_vhost_alias+I+mass virtual hosting module"
297   "modules/metadata/mod_cern_meta+O+CERN-type meta files"
298   "modules/metadata/mod_env+A+clearing/setting of ENV vars"
299   "modules/metadata/mod_expires+I+Expires header control"
300   "modules/metadata/mod_headers+A+HTTP header control"
301   "modules/metadata/mod_ident+O+RFC 1413 identity check"
302   "modules/metadata/mod_mime_magic+O+automagically determining MIME type"
303   "modules/metadata/mod_remoteip+I+translate header contents to an apparent client remote_ip"
304   "modules/metadata/mod_setenvif+A+basing ENV vars on headers"
305   "modules/metadata/mod_unique_id+I+per-request unique ids"
306   "modules/metadata/mod_usertrack+I+user-session tracking"
307   "modules/metadata/mod_version+A+determining httpd version in config files"
308   "modules/proxy/balancers/mod_lbmethod_bybusyness+I+Apache proxy Load balancing by busyness"
309   "modules/proxy/balancers/mod_lbmethod_byrequests+I+Apache proxy Load balancing by request counting"
310   "modules/proxy/balancers/mod_lbmethod_bytraffic+I+Apache proxy Load balancing by traffic counting"
311   "modules/proxy/balancers/mod_lbmethod_heartbeat+I+Apache proxy Load balancing from Heartbeats"
312   "modules/proxy/mod_proxy_ajp+I+Apache proxy AJP module.  Requires and is enabled by --enable-proxy."
313   "modules/proxy/mod_proxy_balancer+I+Apache proxy BALANCER module.  Requires and is enabled by --enable-proxy."
314   "modules/proxy/mod_proxy+I+Apache proxy module"
315   "modules/proxy/mod_proxy_connect+I+Apache proxy CONNECT module.  Requires and is enabled by --enable-proxy."
316   "modules/proxy/mod_proxy_express+I+mass reverse-proxy module. Requires --enable-proxy."
317   "modules/proxy/mod_proxy_fcgi+I+Apache proxy FastCGI module.  Requires and is enabled by --enable-proxy."
318   "modules/proxy/mod_proxy_ftp+I+Apache proxy FTP module.  Requires and is enabled by --enable-proxy."
319   "modules/proxy/mod_proxy_http+I+Apache proxy HTTP module.  Requires and is enabled by --enable-proxy."
320   "modules/proxy/mod_proxy_scgi+I+Apache proxy SCGI module.  Requires and is enabled by --enable-proxy."
321   "modules/proxy/mod_proxy_wstunnel+I+Apache proxy Websocket Tunnel module.  Requires and is enabled by --enable-proxy."
322   "modules/session/mod_session+I+session module"
323   "modules/session/mod_session_cookie+I+session cookie module"
324   "modules/session/mod_session_crypto+i+session crypto module"
325   "modules/session/mod_session_dbd+I+session dbd module"
326   "modules/slotmem/mod_slotmem_plain+I+slotmem provider that uses plain memory"
327   "modules/slotmem/mod_slotmem_shm+I+slotmem provider that uses shared memory"
328   "modules/ssl/mod_ssl+i+SSL/TLS support"
329   "modules/test/mod_dialup+O+rate limits static files to dialup modem speeds"
330   "modules/test/mod_optional_fn_export+O+example optional function exporter"
331   "modules/test/mod_optional_fn_import+O+example optional function importer"
332   "modules/test/mod_optional_hook_export+O+example optional hook exporter"
333   "modules/test/mod_optional_hook_import+O+example optional hook importer"
334 )
335
336 # Track which modules actually built have APIs to link against.
337 SET(installed_mod_libs_exps)
338
339 # Define extra definitions, sources, headers, etc. required by some modules.
340 # This could be included in the master list of modules above, though it 
341 # certainly would get a lot more unreadable.
342 SET(mod_apreq_extra_defines          APREQ_DECLARE_EXPORT)
343 SET(mod_apreq_extra_sources          modules/apreq/handle.c)
344 SET(mod_apreq_main_source            modules/apreq/filter.c)
345 SET(mod_authz_dbd_extra_defines      AUTHZ_DBD_DECLARE_EXPORT)
346 SET(mod_authnz_ldap_requires         APR_HAS_LDAP)
347 SET(mod_authnz_ldap_extra_libs       mod_ldap)
348 SET(mod_cache_extra_defines          CACHE_DECLARE_EXPORT)
349 SET(mod_cache_extra_sources
350   modules/cache/cache_storage.c      modules/cache/cache_util.c
351 )
352 SET(mod_cache_install_lib 1)
353 SET(mod_cache_disk_extra_libs        mod_cache)
354 SET(mod_cache_socache_extra_libs     mod_cache)
355 SET(mod_charset_lite_requires        APR_HAS_XLATE)
356 SET(mod_dav_extra_defines            DAV_DECLARE_EXPORT)
357 SET(mod_dav_extra_sources
358   modules/dav/main/liveprop.c        modules/dav/main/props.c
359   modules/dav/main/std_liveprop.c    modules/dav/main/providers.c
360   modules/dav/main/util.c            modules/dav/main/util_lock.c
361 )
362 SET(mod_dav_install_lib 1)
363 SET(mod_dav_fs_extra_sources
364   modules/dav/fs/dbm.c               modules/dav/fs/lock.c
365   modules/dav/fs/repos.c
366 )
367 SET(mod_dav_fs_extra_libs            mod_dav)
368 SET(mod_dav_lock_extra_sources       modules/dav/lock/locks.c)
369 SET(mod_dav_lock_extra_libs          mod_dav)
370 SET(mod_dbd_extra_defines            DBD_DECLARE_EXPORT)
371 SET(mod_deflate_requires             ZLIB_FOUND)
372 IF(ZLIB_FOUND)
373   SET(mod_deflate_extra_includes       ${ZLIB_INCLUDE_DIR})
374   SET(mod_deflate_extra_libs           ${ZLIB_LIBRARIES})
375 ENDIF()
376 SET(mod_firehose_requires            SOMEONE_TO_MAKE_IT_COMPILE_ON_WINDOWS)
377 SET(mod_heartbeat_extra_libs         mod_watchdog)
378 SET(mod_http2_requires               NGHTTP2_FOUND)
379 SET(mod_http2_extra_defines          ssize_t=long)
380 SET(mod_http2_extra_libs             ${NGHTTP2_LIBRARIES})
381 SET(mod_http2_extra_sources
382   modules/http2/h2_alt_svc.c         modules/http2/h2_config.c
383   modules/http2/h2_conn.c            modules/http2/h2_conn_io.c
384   modules/http2/h2_ctx.c             modules/http2/h2_from_h1.c
385   modules/http2/h2_h2.c              modules/http2/h2_io.c
386   modules/http2/h2_io_set.c          modules/http2/h2_mplx.c
387   modules/http2/h2_request.c         modules/http2/h2_response.c
388   modules/http2/h2_session.c         modules/http2/h2_stream.c
389   modules/http2/h2_stream_set.c      modules/http2/h2_switch.c
390   modules/http2/h2_task.c            modules/http2/h2_task_input.c
391   modules/http2/h2_task_output.c     modules/http2/h2_task_queue.c
392   modules/http2/h2_to_h1.c           modules/http2/h2_util.c
393   modules/http2/h2_worker.c          modules/http2/h2_workers.c
394 )
395 SET(mod_ldap_extra_defines           LDAP_DECLARE_EXPORT)
396 SET(mod_ldap_extra_libs              wldap32)
397 SET(mod_ldap_extra_sources
398   modules/ldap/util_ldap_cache.c     modules/ldap/util_ldap_cache_mgr.c
399 )
400 SET(mod_ldap_main_source             modules/ldap/util_ldap.c)
401 SET(mod_ldap_requires                APR_HAS_LDAP)
402 SET(mod_lua_extra_defines            AP_LUA_DECLARE_EXPORT)
403 SET(mod_lua_extra_includes           ${LUA_INCLUDE_DIR})
404 SET(mod_lua_extra_libs               ${LUA_LIBRARIES})
405 SET(mod_lua_extra_sources
406   modules/lua/lua_apr.c              modules/lua/lua_config.c
407   modules/lua/lua_passwd.c           modules/lua/lua_request.c
408   modules/lua/lua_vmprep.c           modules/lua/lua_dbd.c
409 )
410 SET(mod_lua_requires                 LUA51_FOUND)
411 SET(mod_optional_hook_export_extra_defines AP_DECLARE_EXPORT) # bogus reuse of core API prefix
412 SET(mod_proxy_extra_defines          PROXY_DECLARE_EXPORT)
413 SET(mod_proxy_extra_sources          modules/proxy/proxy_util.c)
414 SET(mod_proxy_install_lib 1)
415 SET(mod_proxy_ajp_extra_sources
416   modules/proxy/ajp_header.c         modules/proxy/ajp_link.c
417   modules/proxy/ajp_msg.c            modules/proxy/ajp_utils.c
418 )
419 SET(mod_proxy_ajp_extra_libs         mod_proxy)
420 SET(mod_proxy_balancer_extra_libs    mod_proxy)
421 SET(mod_proxy_connect_extra_libs     mod_proxy)
422 SET(mod_proxy_express_extra_libs     mod_proxy)
423 SET(mod_proxy_fcgi_extra_libs        mod_proxy)
424 SET(mod_proxy_ftp_extra_libs         mod_proxy)
425 SET(mod_proxy_http_extra_libs        mod_proxy)
426 SET(mod_proxy_html_requires          LIBXML2_FOUND)
427 IF(LIBXML2_FOUND)
428   SET(mod_proxy_html_extra_includes    "${LIBXML2_INCLUDE_DIR};${LIBXML2_ICONV_INCLUDE_DIR}")
429   SET(mod_proxy_html_extra_libs        "${LIBXML2_LIBRARIES};${LIBXML2_ICONV_LIBRARIES}")
430 ENDIF()
431 SET(mod_proxy_scgi_extra_libs        mod_proxy)
432 SET(mod_proxy_wstunnel_extra_libs    mod_proxy)
433 SET(mod_ratelimit_extra_defines      AP_RL_DECLARE_EXPORT)
434 SET(mod_sed_extra_sources
435   modules/filters/regexp.c           modules/filters/sed0.c
436   modules/filters/sed1.c
437 )
438 SET(mod_serf_requires                AN_UNIMPLEMENTED_SUPPORT_LIBRARY_REQUIREMENT)
439 SET(mod_session_extra_defines        SESSION_DECLARE_EXPORT)
440 SET(mod_session_install_lib 1)
441 SET(mod_session_cookie_extra_libs    mod_session)
442 SET(mod_session_crypto_requires      APU_HAVE_CRYPTO)
443 SET(mod_session_crypto_extra_libs    mod_session)
444 SET(mod_session_dbd_extra_libs       mod_session)
445 SET(mod_socache_dc_requires          AN_UNIMPLEMENTED_SUPPORT_LIBRARY_REQUIREMENT)
446 SET(mod_ssl_requires                 OPENSSL_FOUND)
447 IF(OPENSSL_FOUND)
448   SET(mod_ssl_extra_includes           ${OPENSSL_INCLUDE_DIR})
449   SET(mod_ssl_extra_libs               ${OPENSSL_LIBRARIES})
450 ENDIF()
451 SET(mod_ssl_extra_sources
452   modules/ssl/ssl_engine_config.c
453   modules/ssl/ssl_engine_init.c      modules/ssl/ssl_engine_io.c
454   modules/ssl/ssl_engine_kernel.c    modules/ssl/ssl_engine_log.c
455   modules/ssl/ssl_engine_mutex.c     modules/ssl/ssl_engine_ocsp.c
456   modules/ssl/ssl_engine_pphrase.c   modules/ssl/ssl_engine_rand.c
457   modules/ssl/ssl_engine_vars.c      modules/ssl/ssl_scache.c
458   modules/ssl/ssl_util.c             modules/ssl/ssl_util_ocsp.c
459   modules/ssl/ssl_util_ssl.c         modules/ssl/ssl_util_stapling.c
460 )
461 SET(mod_status_extra_defines         STATUS_DECLARE_EXPORT)
462 SET(mod_watchdog_install_lib 1)
463 SET(mod_xml2enc_requires             LIBXML2_FOUND)
464 IF(LIBXML2_FOUND)
465   SET(mod_xml2enc_extra_includes     "${LIBXML2_INCLUDE_DIR};${LIBXML2_ICONV_INCLUDE_DIR}")
466   SET(mod_xml2enc_extra_libs         "${LIBXML2_LIBRARIES};${LIBXML2_ICONV_LIBRARIES}")
467 ENDIF()
468 SET(mod_watchdog_extra_defines       AP_WD_DECLARE_EXPORT)
469
470 SET(MODULE_PATHS)
471 FOREACH (modinfo ${MODULE_LIST})
472   STRING(REGEX REPLACE "([^+]*)\\+([^+]*)\\+([^+]*)" "\\1;\\2;\\3" modinfolist ${modinfo})
473   SET(path_to_module)
474   SET(defaultenable)
475   SET(helptext)
476   FOREACH(i ${modinfolist})
477     IF("${path_to_module}" STREQUAL "")
478       SET(path_to_module ${i})
479     ELSEIF("${defaultenable}" STREQUAL "")
480       SET(defaultenable ${i})
481     ELSEIF("${helptext}" STREQUAL "")
482       SET(helptext ${i})
483     ELSE()
484       MESSAGE(FATAL_ERROR "Unexpected field or plus sign in >${modinfo}<")
485     ENDIF()
486   ENDFOREACH()
487
488   # MESSAGE("       path to module: ${path_to_module}")
489   # MESSAGE("enablement by default: ${defaultenable}")
490   # MESSAGE("            help text: ${helptext}")
491
492   STRING(REGEX REPLACE ".*/(mod_[^\\+]+)" "\\1" mod_name       ${path_to_module})
493   STRING(REGEX REPLACE "mod_(.*)"         "\\1" mod_shortname  ${mod_name})
494
495   STRING(TOUPPER "ENABLE_${mod_shortname}" mod_option_name)
496
497   SET(${mod_option_name} ${defaultenable} CACHE STRING ${helptext})
498   SET(MODULE_PATHS "${MODULE_PATHS};${path_to_module}")
499
500 ENDFOREACH()
501
502 SET(install_targets)
503 SET(install_bin_pdb)
504 SET(install_modules) # special handling vs. other installed targets
505 SET(install_modules_pdb)
506 SET(builtin_module_shortnames "win32 mpm_winnt http so") # core added automatically
507 SET(extra_builtin_modules) # the ones specified with -DWITH_MODULES=
508
509 IF(WITH_MODULES) # modules statically linked with the server
510   STRING(REPLACE "," ";" WITH_MODULE_LIST ${WITH_MODULES})
511   FOREACH(static_mod ${WITH_MODULE_LIST})
512     STRING(REGEX MATCH   "[^/]+\\.c"           mod_basename    ${static_mod})
513     STRING(REGEX REPLACE "^mod_(.*)\\.c" "\\1" mod_module_name ${mod_basename})     
514     SET(builtin_module_shortnames "${builtin_module_shortnames} ${mod_module_name}")
515     CONFIGURE_FILE(${static_mod} ${PROJECT_BINARY_DIR}/ COPYONLY)
516     SET(extra_builtin_modules ${extra_builtin_modules} ${PROJECT_BINARY_DIR}/${mod_basename})
517   ENDFOREACH()
518   EXECUTE_PROCESS(COMMAND cmd /c "echo ${builtin_module_shortnames}| awk -f ${CMAKE_CURRENT_SOURCE_DIR}/build/build-modules-c.awk > ${PROJECT_BINARY_DIR}/modules.c" RESULT_VARIABLE rv)
519   IF(rv)
520     MESSAGE(FATAL_ERROR "build-modules-c.awk failed (${rv})")
521   ENDIF()
522 ELSE()
523   # no extra built-in modules; use the default modules.c to avoid the awk prereq
524   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/os/win32/modules.c ${PROJECT_BINARY_DIR}/ COPYONLY)
525 ENDIF()
526
527 # for easy reference from .dll/.so builds
528 CONFIGURE_FILE(os/win32/BaseAddr.ref ${PROJECT_BINARY_DIR}/ COPYONLY)
529
530 ADD_EXECUTABLE(gen_test_char server/gen_test_char.c)
531 GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION)
532 ADD_CUSTOM_COMMAND(
533   COMMENT "Generating character tables, test_char.h, for current locale"
534   DEPENDS gen_test_char
535   COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/test_char.h
536   OUTPUT ${PROJECT_BINARY_DIR}/test_char.h
537 )
538 ADD_CUSTOM_TARGET(
539   test_char_header ALL
540   DEPENDS ${PROJECT_BINARY_DIR}/test_char.h
541 )
542
543 SET(HTTPD_MAIN_SOURCES
544   server/main.c
545 )
546
547 SET(LIBHTTPD_SOURCES
548   ${extra_builtin_modules}
549   ${PROJECT_BINARY_DIR}/modules.c
550   modules/arch/win32/mod_win32.c
551   modules/core/mod_so.c
552   modules/http/byterange_filter.c
553   modules/http/chunk_filter.c
554   modules/http/http_core.c
555   modules/http/http_etag.c
556   modules/http/http_filters.c
557   modules/http/http_protocol.c
558   modules/http/http_request.c
559   os/win32/ap_regkey.c
560   os/win32/util_win32.c
561   server/buildmark.c
562   server/config.c
563   server/connection.c
564   server/core.c
565   server/core_filters.c
566   server/eoc_bucket.c
567   server/eor_bucket.c
568   server/error_bucket.c
569   server/listen.c
570   server/log.c
571   server/mpm/winnt/child.c
572   server/mpm/winnt/mpm_winnt.c
573   server/mpm/winnt/nt_eventlog.c
574   server/mpm/winnt/service.c
575   server/mpm_common.c
576   server/protocol.c
577   server/provider.c
578   server/request.c
579   server/scoreboard.c
580   server/util.c
581   server/util_cfgtree.c
582   server/util_cookies.c
583   server/util_expr_eval.c
584   server/util_expr_parse.c
585   server/util_fcgi.c
586   server/util_expr_scan.c
587   server/util_filter.c
588   server/util_md5.c
589   server/util_mutex.c
590   server/util_pcre.c
591   server/util_regex.c
592   server/util_script.c
593   server/util_time.c
594   server/util_xml.c
595   server/vhost.c
596 )
597
598 CONFIGURE_FILE(os/win32/win32_config_layout.h
599                ${PROJECT_BINARY_DIR}/ap_config_layout.h)
600
601 SET(HTTPD_INCLUDE_DIRECTORIES
602   ${PROJECT_BINARY_DIR}
603   ${EXTRA_INCLUDES}
604   # see discussion in cmake bug 13188 regarding oddities with relative paths
605   ${CMAKE_CURRENT_SOURCE_DIR}/include
606   ${CMAKE_CURRENT_SOURCE_DIR}/os/win32
607   ${CMAKE_CURRENT_SOURCE_DIR}/modules/core
608   ${CMAKE_CURRENT_SOURCE_DIR}/modules/database
609   ${CMAKE_CURRENT_SOURCE_DIR}/modules/dav/main
610   ${CMAKE_CURRENT_SOURCE_DIR}/modules/filters
611   ${CMAKE_CURRENT_SOURCE_DIR}/modules/generators
612   ${CMAKE_CURRENT_SOURCE_DIR}/modules/proxy
613   ${CMAKE_CURRENT_SOURCE_DIR}/modules/session
614   ${CMAKE_CURRENT_SOURCE_DIR}/modules/ssl
615   ${CMAKE_CURRENT_SOURCE_DIR}/server
616   ${APR_INCLUDE_DIR}
617   ${PCRE_INCLUDE_DIR}
618 )
619
620 # The .h files we install from outside the main include directory
621 # largely parallel the include directories above.
622 SET(other_installed_h
623   ${PROJECT_BINARY_DIR}/ap_config_layout.h
624   ${CMAKE_CURRENT_SOURCE_DIR}/os/win32/os.h
625   ${CMAKE_CURRENT_SOURCE_DIR}/modules/cache/mod_cache.h
626   ${CMAKE_CURRENT_SOURCE_DIR}/modules/cache/cache_common.h
627   ${CMAKE_CURRENT_SOURCE_DIR}/modules/core/mod_so.h
628   ${CMAKE_CURRENT_SOURCE_DIR}/modules/core/mod_watchdog.h
629   ${CMAKE_CURRENT_SOURCE_DIR}/modules/database/mod_dbd.h
630   ${CMAKE_CURRENT_SOURCE_DIR}/modules/dav/main/mod_dav.h
631   ${CMAKE_CURRENT_SOURCE_DIR}/modules/filters/mod_include.h
632   ${CMAKE_CURRENT_SOURCE_DIR}/modules/filters/mod_xml2enc.h
633   ${CMAKE_CURRENT_SOURCE_DIR}/modules/generators/mod_cgi.h
634   ${CMAKE_CURRENT_SOURCE_DIR}/modules/generators/mod_status.h
635   ${CMAKE_CURRENT_SOURCE_DIR}/modules/loggers/mod_log_config.h
636   ${CMAKE_CURRENT_SOURCE_DIR}/modules/mappers/mod_rewrite.h
637   ${CMAKE_CURRENT_SOURCE_DIR}/modules/proxy/mod_proxy.h
638   ${CMAKE_CURRENT_SOURCE_DIR}/modules/session/mod_session.h
639   ${CMAKE_CURRENT_SOURCE_DIR}/modules/ssl/mod_ssl.h
640 )
641 # When mod_serf is buildable, don't forget to copy modules/proxy/mod_serf.h
642
643 INCLUDE_DIRECTORIES(${HTTPD_INCLUDE_DIRECTORIES})
644
645 SET(HTTPD_SYSTEM_LIBS
646   ws2_32
647   mswsock
648 )
649
650 ###########   HTTPD MODULES     ############
651 SET(LoadModules)
652 SET(mods_built_and_loaded)
653 SET(mods_built_but_not_loaded)
654 SET(mods_omitted)
655 FOREACH (mod ${MODULE_PATHS})
656   # Build different forms of the module name; e.g., 
657   #   mod_name->mod_cgi, mod_module_name->cgi_module, mod_shortname->cgi
658   STRING(REGEX REPLACE ".*/(mod_[^\\+]+)" "\\1"        mod_name        ${mod})
659   STRING(REGEX REPLACE "mod_(.*)"         "\\1_module" mod_module_name ${mod_name})
660   STRING(REGEX REPLACE "mod_(.*)"         "\\1"        mod_shortname   ${mod_name})
661
662   # Is it enabled?
663   STRING(TOUPPER "ENABLE_${mod_shortname}" enable_mod)
664   SET(enable_mod_val ${${enable_mod}})
665
666   # Is ENABLE_MODULES set to a higher value?
667   GET_MOD_ENABLE_RANK(${mod_name} ${enable_mod_val} this_mod_rank)
668   IF(this_mod_rank LESS enable_modules_rank)
669     # Use the value from ENABLE_MODULES
670     SET(enable_mod_val ${ENABLE_MODULES})
671   ENDIF()
672
673   IF(NOT ${enable_mod_val} STREQUAL "O") # build of module is desired
674     SET(mod_requires "${mod_name}_requires")
675     STRING(TOUPPER ${enable_mod_val} enable_mod_val_upper)
676     IF(NOT ${${mod_requires}} STREQUAL "") # module has some prerequisite
677       IF(NOT ${${mod_requires}}) # prerequisite doesn't exist
678         IF(NOT ${enable_mod_val} STREQUAL ${enable_mod_val_upper}) # lower case, so optional based on prereq
679           MESSAGE(STATUS "${mod_name} was requested but couldn't be built due to a missing prerequisite (${${mod_requires}})")
680           SET(enable_mod_val_upper "O") # skip due to missing prerequisite
681         ELSE() # must be upper case "A" or "I" (or coding error above)
682           MESSAGE(FATAL_ERROR "${mod_name} was requested but couldn't be built due to a missing prerequisite (${${mod_requires}})")
683         ENDIF()
684       ENDIF()
685     ENDIF()
686     # map a->A, i->I, O->O for remaining logic since prereq checking is over
687     SET(enable_mod_val ${enable_mod_val_upper})
688   ENDIF()
689   
690   IF(${enable_mod_val} STREQUAL "O")
691     # ignore
692     SET(mods_omitted ${mods_omitted} ${mod_name})
693   ELSE()
694     # Handle whether or not the LoadModule is commented out.
695     IF(${enable_mod_val} STREQUAL "A")
696       SET(LoadModules "${LoadModules}LoadModule ${mod_module_name} modules/${mod_name}.so\n")
697       SET(mods_built_and_loaded ${mods_built_and_loaded} ${mod_name})
698     ELSEIF(${enable_mod_val} STREQUAL "I")
699       SET(LoadModules "${LoadModules}# LoadModule ${mod_module_name} modules/${mod_name}.so\n")
700       SET(mods_built_but_not_loaded ${mods_built_but_not_loaded} ${mod_name})
701     ELSE()
702       MESSAGE(FATAL_ERROR "${enable_mod} must be set to \"A\", \"I\", or \"O\" instead of \"${enable_mod_val}\"")
703     ENDIF()
704
705     # Handle building it.
706     SET(mod_main_source "${mod_name}_main_source")
707     SET(mod_extra_sources "${mod_name}_extra_sources")
708
709     IF("${${mod_main_source}}" STREQUAL "")
710       SET(tmp_mod_main_source "${mod}.c")
711     ELSE()
712       SET(tmp_mod_main_source ${${mod_main_source}})
713     ENDIF()
714     SET(all_mod_sources ${tmp_mod_main_source} ${${mod_extra_sources}})
715     ADD_LIBRARY(${mod_name} SHARED ${all_mod_sources} build/win32/httpd.rc)
716     SET(install_modules ${install_modules} ${mod_name})
717     SET(install_modules_pdb ${install_modules_pdb} "${PROJECT_BINARY_DIR}/${mod_name}.pdb")
718     IF("${${mod_name}_install_lib}")
719       SET(installed_mod_libs_exps
720           ${installed_mod_libs_exps}
721           "${PROJECT_BINARY_DIR}/${mod_name}.lib"
722           "${PROJECT_BINARY_DIR}/${mod_name}.exp"
723       )
724     ENDIF()
725     SET(mod_extra_libs "${mod_name}_extra_libs")
726     SET_TARGET_PROPERTIES(${mod_name} PROPERTIES
727       SUFFIX .so
728       LINK_FLAGS /base:@${PROJECT_BINARY_DIR}/BaseAddr.ref,${mod_name}.so
729     )
730     TARGET_LINK_LIBRARIES(${mod_name} ${${mod_extra_libs}} libhttpd ${EXTRA_LIBS} ${APR_LIBRARIES} ${HTTPD_SYSTEM_LIBS})
731     DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "${mod_name} for Apache HTTP Server")
732     SET_TARGET_PROPERTIES(${mod_name} PROPERTIES COMPILE_FLAGS "${define_long_name} -DBIN_NAME=${mod_name}.so ${EXTRA_COMPILE_FLAGS}")
733
734     # Extra defines?
735     SET(mod_extra_defines "${mod_name}_extra_defines")
736     IF(NOT ${${mod_extra_defines}} STREQUAL "")
737       SET_TARGET_PROPERTIES(${mod_name} PROPERTIES COMPILE_DEFINITIONS ${${mod_extra_defines}})
738     ENDIF()
739
740     # Extra includes?
741     SET(mod_extra_includes "${mod_name}_extra_includes")
742     IF(NOT "${${mod_extra_includes}}" STREQUAL "")
743       SET(tmp_includes ${HTTPD_INCLUDE_DIRECTORIES} ${${mod_extra_includes}})
744       SET_TARGET_PROPERTIES(${mod_name} PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}")
745       GET_PROPERTY(tmp_includes TARGET ${mod_name} PROPERTY INCLUDE_DIRECTORIES)
746     ENDIF()
747
748   ENDIF()
749 ENDFOREACH()
750
751 ###########   HTTPD LIBRARIES   ############
752 ADD_LIBRARY(libhttpd SHARED ${LIBHTTPD_SOURCES} build/win32/httpd.rc)
753 SET_TARGET_PROPERTIES(libhttpd PROPERTIES
754   LINK_FLAGS /base:@${PROJECT_BINARY_DIR}/BaseAddr.ref,libhttpd.dll
755 )
756 SET(install_targets ${install_targets} libhttpd)
757 SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libhttpd.pdb)
758 TARGET_LINK_LIBRARIES(libhttpd ${EXTRA_LIBS} ${APR_LIBRARIES} ${PCRE_LIBRARIES} ${HTTPD_SYSTEM_LIBS})
759 DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server Core")
760 SET_TARGET_PROPERTIES(libhttpd PROPERTIES COMPILE_FLAGS "-DAP_DECLARE_EXPORT ${define_long_name} -DBIN_NAME=libhttpd.dll ${EXTRA_COMPILE_FLAGS}")
761 ADD_DEPENDENCIES(libhttpd test_char_header)
762
763 ###########   HTTPD EXECUTABLES   ##########
764 ADD_EXECUTABLE(httpd server/main.c build/win32/httpd.rc)
765 SET(install_targets ${install_targets} httpd)
766 SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/httpd.pdb)
767 DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server")
768 SET_TARGET_PROPERTIES(httpd PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=httpd.exe -DICON_FILE=${CMAKE_SOURCE_DIR}/build/win32/apache.ico ${EXTRA_COMPILE_FLAGS}")
769 TARGET_LINK_LIBRARIES(httpd libhttpd ${EXTRA_LIBS})
770
771 SET(standard_support
772   ab
773   htcacheclean
774   htdbm
775   htdigest
776   htpasswd
777   httxt2dbm
778   logresolve
779   rotatelogs
780 )
781
782 SET(htdbm_extra_sources support/passwd_common.c)
783 SET(htpasswd_extra_sources support/passwd_common.c)
784
785 FOREACH(pgm ${standard_support})
786   SET(extra_sources ${pgm}_extra_sources)
787   ADD_EXECUTABLE(${pgm} support/${pgm}.c ${${extra_sources}} build/win32/httpd.rc)
788   SET(install_targets ${install_targets} ${pgm})
789   SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/${pgm}.pdb)
790   DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server ${pgm} program")
791   SET_TARGET_PROPERTIES(${pgm} PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=${pgm}.exe ${EXTRA_COMPILE_FLAGS}")
792   TARGET_LINK_LIBRARIES(${pgm} ${EXTRA_LIBS} ${APR_LIBRARIES})
793 ENDFOREACH()
794
795 IF(OPENSSL_FOUND)
796   ADD_EXECUTABLE(abs support/ab.c build/win32/httpd.rc)
797   SET(install_targets ${install_targets} abs)
798   SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/abs.pdb)
799   SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_DEFINITIONS HAVE_OPENSSL)
800   SET(tmp_includes ${HTTPD_INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_DIR})
801   SET_TARGET_PROPERTIES(abs PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}")
802   DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server ab/SSL program")
803   SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=abs.exe ${EXTRA_COMPILE_FLAGS}")
804   TARGET_LINK_LIBRARIES(abs ${EXTRA_LIBS} ${APR_LIBRARIES} ${OPENSSL_LIBRARIES})
805 ENDIF()
806 GET_PROPERTY(tmp_includes TARGET ab PROPERTY INCLUDE_DIRECTORIES)
807
808 # getting duplicate manifest error with ApacheMonitor
809 # ADD_EXECUTABLE(ApacheMonitor support/win32/ApacheMonitor.c support/win32/ApacheMonitor.rc)
810 # SET(install_targets ${install_targets} ApacheMonitor)
811 # SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/ApacheMonitor.pdb)
812 # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE)
813 # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=ApacheMonitor -DBIN_NAME=ApacheMonitor.exe ${EXTRA_COMPILE_FLAGS}")
814 # TARGET_LINK_LIBRARIES(ApacheMonitor ${EXTRA_LIBS} ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32)
815
816 ###########  CONFIGURATION FILES ###########
817 # Set up variables used in the .conf file templates
818 SET(LoadModule          "${LoadModules}")
819 SET(Port                "80" CACHE STRING "http port to listen on")
820 SET(SSLPort             "443" CACHE STRING "https port to listen on")
821 SET(ServerRoot          "${CMAKE_INSTALL_PREFIX}")
822 SET(exp_cgidir          "${CMAKE_INSTALL_PREFIX}/cgi-bin")
823 SET(exp_htdocsdir       "${CMAKE_INSTALL_PREFIX}/htdocs")
824 SET(exp_iconsdir        "${CMAKE_INSTALL_PREFIX}/icons")
825 SET(exp_errordir        "${CMAKE_INSTALL_PREFIX}/error")
826 SET(exp_manualdir       "${CMAKE_INSTALL_PREFIX}/manual")
827 SET(rel_logfiledir      "logs")
828 SET(rel_runtimedir      "logs")
829 SET(rel_sysconfdir      "conf")
830 FILE(GLOB_RECURSE conffiles RELATIVE ${CMAKE_SOURCE_DIR}/docs/conf "docs/conf/*")
831 FOREACH(template ${conffiles})
832   STRING(REPLACE ".conf.in" ".conf" conf ${template})
833   FILE(READ "docs/conf/${template}" template_text)
834     IF(template MATCHES ".conf.in$")
835       # substitute @var@/@@var@@ in .conf.in
836       STRING(REPLACE "@@" "@" template_text ${template_text})
837       STRING(CONFIGURE "${template_text}" template_text @ONLY)
838     ENDIF()
839   FILE(WRITE ${CMAKE_BINARY_DIR}/conf/original/${conf} "${template_text}")
840   FILE(WRITE ${CMAKE_BINARY_DIR}/conf/${conf} "${template_text}")
841 ENDFOREACH()
842
843 ###########   INSTALLATION   ###########
844 INSTALL(TARGETS ${install_targets}
845         RUNTIME DESTINATION bin
846         LIBRARY DESTINATION lib
847         ARCHIVE DESTINATION lib
848        )
849 INSTALL(TARGETS ${install_modules}
850         RUNTIME DESTINATION modules
851        )
852
853 IF(INSTALL_PDB)
854   INSTALL(FILES ${install_bin_pdb}
855           DESTINATION bin
856           CONFIGURATIONS RelWithDebInfo Debug)
857
858   INSTALL(FILES ${install_modules_pdb}
859           DESTINATION modules
860           CONFIGURATIONS RelWithDebInfo Debug)
861 ENDIF()
862
863 INSTALL(DIRECTORY include/ DESTINATION include
864     FILES_MATCHING PATTERN "*.h"
865 )
866 INSTALL(FILES ${other_installed_h} DESTINATION include)
867 INSTALL(FILES ${installed_mod_libs_exps} DESTINATION lib)
868 INSTALL(FILES "${CMAKE_BINARY_DIR}/libhttpd.exp" DESTINATION LIB)
869
870 IF(INSTALL_MANUAL) # Silly?  This takes a while, and a dev doesn't need it.
871   INSTALL(DIRECTORY docs/manual/ DESTINATION manual)
872 ENDIF()
873
874 INSTALL(DIRECTORY DESTINATION logs)
875 INSTALL(DIRECTORY DESTINATION cgi-bin)
876
877 INSTALL(CODE "EXECUTE_PROCESS(COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/build/cpR_noreplace.pl ${CMAKE_CURRENT_SOURCE_DIR}/docs/error ${CMAKE_INSTALL_PREFIX}/error ifdestmissing)")
878
879 INSTALL(CODE "EXECUTE_PROCESS(COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/build/cpR_noreplace.pl ${CMAKE_CURRENT_SOURCE_DIR}/docs/docroot ${CMAKE_INSTALL_PREFIX}/htdocs ifdestmissing)")
880
881 INSTALL(CODE "EXECUTE_PROCESS(COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/build/cpR_noreplace.pl ${CMAKE_CURRENT_SOURCE_DIR}/docs/icons ${CMAKE_INSTALL_PREFIX}/icons ifdestmissing)")
882
883 # Copy generated .conf files from the build directory to the install,
884 # without overwriting stuff already there.
885 INSTALL(CODE "EXECUTE_PROCESS(COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/build/cpR_noreplace.pl ${CMAKE_BINARY_DIR}/conf ${CMAKE_INSTALL_PREFIX}/conf)")
886 # But conf/original is supposed to be overwritten.
887 # Note: FILE(TO_NATIVE_PATH ...) leaves the backslashes unescaped, which
888 #       generates warnings.  Just do it manually since this build only supports
889 #       Windows anyway.
890 STRING(REPLACE "/" "\\\\" native_src ${CMAKE_BINARY_DIR}/conf/original)
891 STRING(REPLACE "/" "\\\\" native_dest ${CMAKE_INSTALL_PREFIX}/conf/original)
892 INSTALL(CODE "EXECUTE_PROCESS(COMMAND xcopy ${native_src} ${native_dest} /Q /S /Y)")
893
894 STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
895 MESSAGE(STATUS "")
896 MESSAGE(STATUS "")
897 MESSAGE(STATUS "Apache httpd configuration summary:")
898 MESSAGE(STATUS "")
899 MESSAGE(STATUS "  Build type ...................... : ${CMAKE_BUILD_TYPE}")
900 MESSAGE(STATUS "  Install .pdb (if available)...... : ${INSTALL_PDB}")
901 MESSAGE(STATUS "  Install manual .................. : ${INSTALL_MANUAL}")
902 MESSAGE(STATUS "  Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
903 MESSAGE(STATUS "  C compiler ...................... : ${CMAKE_C_COMPILER}")
904 MESSAGE(STATUS "  APR include directory ........... : ${APR_INCLUDE_DIR}")
905 MESSAGE(STATUS "  APR libraries ................... : ${APR_LIBRARIES}")
906 MESSAGE(STATUS "  OpenSSL include directory ....... : ${OPENSSL_INCLUDE_DIR}")
907 MESSAGE(STATUS "  OpenSSL libraries ............... : ${OPENSSL_LIBRARIES}")
908 MESSAGE(STATUS "  PCRE include directory .......... : ${PCRE_INCLUDE_DIR}")
909 MESSAGE(STATUS "  PCRE libraries .................. : ${PCRE_LIBRARIES}")
910 MESSAGE(STATUS "  libxml2 iconv prereq include dir. : ${LIBXML2_ICONV_INCLUDE_DIR}")
911 MESSAGE(STATUS "  libxml2 iconv prereq libraries .. : ${LIBXML2_ICONV_LIBRARIES}")
912 MESSAGE(STATUS "  Extra include directories ....... : ${EXTRA_INCLUDES}")
913 MESSAGE(STATUS "  Extra compile flags ............. : ${EXTRA_COMPILE_FLAGS}")
914 MESSAGE(STATUS "  Extra libraries ................. : ${EXTRA_LIBS}")
915
916 MESSAGE(STATUS "  Modules built and loaded:")
917 FOREACH(mod ${mods_built_and_loaded})
918   MESSAGE(STATUS "    ${mod}")
919 ENDFOREACH()
920
921 MESSAGE(STATUS "  Modules built but not loaded:")
922 FOREACH(mod ${mods_built_but_not_loaded})
923   MESSAGE(STATUS "    ${mod}")
924 ENDFOREACH()
925
926 MESSAGE(STATUS "  Modules not built:")
927 FOREACH(mod ${mods_omitted})
928   MESSAGE(STATUS "    ${mod}")
929 ENDFOREACH()