summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2013-08-29 01:01:12 +0200
committerJeff Trawick <trawick@apache.org>2013-08-29 01:01:12 +0200
commit4cd73aa7703aa957fbba689798dce961f2f19e27 (patch)
treec38d947439974c45f27dfdfc0c10481b2ef9bad5 /CMakeLists.txt
parentGenerate and install .conf files (diff)
downloadapache2-4cd73aa7703aa957fbba689798dce961f2f19e27.tar.xz
apache2-4cd73aa7703aa957fbba689798dce961f2f19e27.zip
Support new configuration feature
-DWITH_MODULES=d:/path/to/mod_foo.c,d:/path/to/mod_bar.c, analogous to --with-module=modpath:/path/to/mod_foo.c,... with the autoconf-based build. This introduces a dependency on awk, but only for users that use this feature. Other users will get the canned os/win32/modules.c. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1518414 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt35
1 files changed, 34 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3116aa0bc0..1e8a922cd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,8 @@ PROJECT(HTTPD C)
# source tree)
# 2. Make sure perl is in your PATH. Additionally, some backends may want
# your compile tools in PATH. (Hint: "Visual Studio Command Prompt")
+# In the unlikely event that you use -DWITH_MODULES, make sure awk is
+# in PATH.
# 3. cmake -G "some backend, like 'NMake Makefiles'" \
# -DCMAKE_INSTALL_PREFIX=d:/path/to/httpdinst \
# -DPCRE_INCLUDE_DIR=d:/path/to/pcreinst/include \
@@ -46,6 +48,13 @@ PROJECT(HTTPD C)
# -DENABLE_MOD_PROXY_HTML="i" (If the prereqs are found, build it but
# don't activate it in the default .conf.)
#
+# WITH_MODULES:
+# Comma-separated paths to single file modules to statically link into
+# the server, like the --with-module=modpath:/path/to/mod_foo.c with
+# the autoconf-based build. Key differences: The modpath (e.g.,
+# "generators") isn't provided or used, and the copy of the module
+# source being built is automatically updated when it changes.
+#
# Port and SSLPort: port numbers for substitution into default .conf files
# Defaults are 80 and 443.
#
@@ -87,6 +96,9 @@ SET(LIBXML2_ICONV_INCLUDE_DIR "" CACHE STRING "Directory
SET(LIBXML2_ICONV_LIBRARIES "" CACHE STRING "iconv libraries to link with for libxml2")
# end support library configuration
+# Misc. options
+SET(WITH_MODULES "" CACHE STRING "comma-separated paths to single-file modules to statically link into the server")
+
# Options for each available module
# "A" ("A"ctive) means installed and active in default .conf, fail if can't be built
# "I" ("I"nactive) means installed and inactive (LoadModule commented out) in default .conf, fail if can't be built
@@ -338,6 +350,26 @@ ENDFOREACH()
SET(install_targets)
SET(install_modules) # special handling vs. other installed targets
+SET(builtin_module_shortnames "win32 mpm_winnt http so") # core added automatically
+SET(extra_builtin_modules) # the ones specified with -DWITH_MODULES=
+
+IF(WITH_MODULES) # modules statically linked with the server
+ STRING(REPLACE "," ";" WITH_MODULE_LIST ${WITH_MODULES})
+ FOREACH(static_mod ${WITH_MODULE_LIST})
+ STRING(REGEX MATCH "[^/]+\\.c" mod_basename ${static_mod})
+ STRING(REGEX REPLACE "^mod_(.*)\\.c" "\\1" mod_module_name ${mod_basename})
+ SET(builtin_module_shortnames "${builtin_module_shortnames} ${mod_module_name}")
+ CONFIGURE_FILE(${static_mod} ${PROJECT_BINARY_DIR}/ COPYONLY)
+ SET(extra_builtin_modules ${extra_builtin_modules} ${PROJECT_BINARY_DIR}/${mod_basename})
+ ENDFOREACH()
+ 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)
+ IF(rv)
+ MESSAGE(FATAL_ERROR "build-modules-c.awk failed (${rv})")
+ ENDIF()
+ELSE()
+ # no extra built-in modules; use the default modules.c to avoid the awk prereq
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/os/win32/modules.c ${PROJECT_BINARY_DIR}/ COPYONLY)
+ENDIF()
ADD_EXECUTABLE(gen_test_char server/gen_test_char.c)
GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION)
@@ -357,6 +389,8 @@ SET(HTTPD_MAIN_SOURCES
)
SET(LIBHTTPD_SOURCES
+ ${extra_builtin_modules}
+ ${PROJECT_BINARY_DIR}/modules.c
modules/arch/win32/mod_win32.c
modules/core/mod_so.c
modules/http/byterange_filter.c
@@ -367,7 +401,6 @@ SET(LIBHTTPD_SOURCES
modules/http/http_protocol.c
modules/http/http_request.c
os/win32/ap_regkey.c
- os/win32/modules.c
os/win32/util_win32.c
server/buildmark.c
server/config.c