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