diff options
author | Jeff Trawick <trawick@apache.org> | 2013-11-18 21:57:52 +0100 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2013-11-18 21:57:52 +0100 |
commit | 720de506f7f5be3b1b02cbb3ae01c04763ac3de9 (patch) | |
tree | acb8ff7fbedd5f906aa018a9f187f4884751a9ca /CMakeLists.txt | |
parent | fix versioninfo fields for abs.exe (diff) | |
download | apache2-720de506f7f5be3b1b02cbb3ae01c04763ac3de9.tar.xz apache2-720de506f7f5be3b1b02cbb3ae01c04763ac3de9.zip |
Workaround issue with defining a preprocessor symbol to a string value
with embedded blanks.
The extra, escaped quoting in the original version is required for passing
the definition over the command-line, but it broke Visual Studio builds.
For now, avoid the extra quoting when generating for Visual Studio.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1543149 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 385af6a8e4..89e8146500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,16 @@ FOREACH(onelib ${APR_LIBRARIES}) ENDIF() ENDFOREACH() +MACRO(DEFINE_WITH_BLANKS output_definition input_symbol input_value) + IF(MSVC_IDE) + SET(${output_definition} "-D${input_symbol}=\"${input_value}\"") + ELSE() + # assume command-line tool, where extra quotes must be added and escaped to + # survive + SET(${output_definition} "-D${input_symbol}=\"\\\"${input_value}\\\"\"") + ENDIF() +ENDMACRO() + MACRO(GET_MOD_ENABLE_RANK macro_modname macro_mod_enable_val macro_output_rank) IF(${macro_mod_enable_val} STREQUAL "O") SET(${macro_output_rank} 0) @@ -695,7 +705,8 @@ FOREACH (mod ${MODULE_PATHS}) LINK_FLAGS /base:@${PROJECT_BINARY_DIR}/BaseAddr.ref,${mod_name}.so ) TARGET_LINK_LIBRARIES(${mod_name} ${${mod_extra_libs}} libhttpd ${EXTRA_LIBS} ${APR_LIBRARIES} ${HTTPD_SYSTEM_LIBS}) - SET_TARGET_PROPERTIES(${mod_name} PROPERTIES COMPILE_FLAGS "-DLONG_NAME=\"\\\"${mod_name} for Apache HTTP Server\\\"\" -DBIN_NAME=${mod_name}.so ${EXTRA_COMPILE_FLAGS}") + DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "${mod_name} for Apache HTTP Server") + SET_TARGET_PROPERTIES(${mod_name} PROPERTIES COMPILE_FLAGS "${define_long_name} -DBIN_NAME=${mod_name}.so ${EXTRA_COMPILE_FLAGS}") # Extra defines? SET(mod_extra_defines "${mod_name}_extra_defines") @@ -722,14 +733,16 @@ SET_TARGET_PROPERTIES(libhttpd PROPERTIES SET(install_targets ${install_targets} libhttpd) SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libhttpd.pdb) TARGET_LINK_LIBRARIES(libhttpd ${EXTRA_LIBS} ${APR_LIBRARIES} ${PCRE_LIBRARIES} ${HTTPD_SYSTEM_LIBS}) -SET_TARGET_PROPERTIES(libhttpd PROPERTIES COMPILE_FLAGS "-DAP_DECLARE_EXPORT -DAPREQ_DECLARE_EXPORT -DLONG_NAME=\"\\\"Apache HTTP Server Core\\\"\" -DBIN_NAME=libhttpd.dll ${EXTRA_COMPILE_FLAGS}") +DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server Core") +SET_TARGET_PROPERTIES(libhttpd PROPERTIES COMPILE_FLAGS "-DAP_DECLARE_EXPORT -DAPREQ_DECLARE_EXPORT ${define_long_name} -DBIN_NAME=libhttpd.dll ${EXTRA_COMPILE_FLAGS}") ADD_DEPENDENCIES(libhttpd test_char_header) ########### HTTPD EXECUTABLES ########## ADD_EXECUTABLE(httpd server/main.c build/win32/httpd.rc) SET(install_targets ${install_targets} httpd) SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/httpd.pdb) -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}") +DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server") +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}") TARGET_LINK_LIBRARIES(httpd libhttpd ${EXTRA_LIBS}) SET(standard_support @@ -751,7 +764,8 @@ FOREACH(pgm ${standard_support}) ADD_EXECUTABLE(${pgm} support/${pgm}.c ${${extra_sources}} build/win32/httpd.rc) SET(install_targets ${install_targets} ${pgm}) SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/${pgm}.pdb) - SET_TARGET_PROPERTIES(${pgm} PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=\"\\\"Apache HTTP Server ${pgm} program\\\"\" -DBIN_NAME=${pgm}.exe ${EXTRA_COMPILE_FLAGS}") + DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server ${pgm} program") + SET_TARGET_PROPERTIES(${pgm} PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=${pgm}.exe ${EXTRA_COMPILE_FLAGS}") TARGET_LINK_LIBRARIES(${pgm} ${EXTRA_LIBS} ${APR_LIBRARIES}) ENDFOREACH() @@ -762,7 +776,8 @@ IF(OPENSSL_FOUND) SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_DEFINITIONS HAVE_OPENSSL) SET(tmp_includes ${HTTPD_INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_DIR}) SET_TARGET_PROPERTIES(abs PROPERTIES INCLUDE_DIRECTORIES "${tmp_includes}") - SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=\"\\\"Apache HTTP Server ab/SSL program\\\"\" -DBIN_NAME=abs.exe ${EXTRA_COMPILE_FLAGS}") + DEFINE_WITH_BLANKS(define_long_name "LONG_NAME" "Apache HTTP Server ab/SSL program") + SET_TARGET_PROPERTIES(abs PROPERTIES COMPILE_FLAGS "-DAPP_FILE ${define_long_name} -DBIN_NAME=abs.exe ${EXTRA_COMPILE_FLAGS}") TARGET_LINK_LIBRARIES(abs ${EXTRA_LIBS} ${APR_LIBRARIES} ${OPENSSL_LIBRARIES}) ENDIF() GET_PROPERTY(tmp_includes TARGET ab PROPERTY INCLUDE_DIRECTORIES) @@ -772,7 +787,7 @@ GET_PROPERTY(tmp_includes TARGET ab PROPERTY INCLUDE_DIRECTORIES) # SET(install_targets ${install_targets} ApacheMonitor) # SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/ApacheMonitor.pdb) # SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE) -# SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=\"\\\"ApacheMonitor\\\"\" -DBIN_NAME=ApacheMonitor.exe ${EXTRA_COMPILE_FLAGS}") +# SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=ApacheMonitor -DBIN_NAME=ApacheMonitor.exe ${EXTRA_COMPILE_FLAGS}") # TARGET_LINK_LIBRARIES(ApacheMonitor ${EXTRA_LIBS} ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32) ########### CONFIGURATION FILES ########### |