You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2013/08/29 01:01:12 UTC

svn commit: r1518414 - /httpd/httpd/trunk/CMakeLists.txt

Author: trawick
Date: Wed Aug 28 23:01:12 2013
New Revision: 1518414

URL: http://svn.apache.org/r1518414
Log:
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.

Modified:
    httpd/httpd/trunk/CMakeLists.txt

Modified: httpd/httpd/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CMakeLists.txt?rev=1518414&r1=1518413&r2=1518414&view=diff
==============================================================================
--- httpd/httpd/trunk/CMakeLists.txt (original)
+++ httpd/httpd/trunk/CMakeLists.txt Wed Aug 28 23:01:12 2013
@@ -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     ""    
 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