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