Update patch for MSVC static compilation (see Bugzilla #1681).

This commit is contained in:
Philip.Hazel 2016-06-24 09:07:15 +00:00
parent b7850e4fca
commit d6bec3e2a5
2 changed files with 13 additions and 6 deletions

View File

@ -71,7 +71,9 @@
# 2015-07-16 PH updated for new pcre2_find_bracket source module # 2015-07-16 PH updated for new pcre2_find_bracket source module
# 2015-08-24 PH correct C_FLAGS setting (patch from Roy Ivy III) # 2015-08-24 PH correct C_FLAGS setting (patch from Roy Ivy III)
# 2015-10=16 PH added support for never-backslash-C # 2015-10=16 PH added support for never-backslash-C
# 2016-03-01 PH appliced Chris Wilson's patch for MSVC static # 2016-03-01 PH applied Chris Wilson's patch for MSVC static
# 2016-06-24 PH applied Chris Wilson's second patch, putting the first under
# a new option instead of being unconditional.
PROJECT(PCRE2 C) PROJECT(PCRE2 C)
@ -188,6 +190,9 @@ IF (MINGW)
ENDIF(MINGW) ENDIF(MINGW)
IF(MSVC) IF(MSVC)
OPTION(PCRE_STATIC_RUNTIME OFF CACHE BOOL
"ON=Compile against the static runtime (/MT)."
OFF)
OPTION(INSTALL_MSVC_PDB OPTION(INSTALL_MSVC_PDB
"ON=Install .pdb files built by MSVC, if generated" "ON=Install .pdb files built by MSVC, if generated"
OFF) OFF)
@ -467,14 +472,14 @@ ENDIF(MSVC AND NOT PCRE2_STATIC)
# Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681 # Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
# This code was taken from the CMake wiki, not from WebM. # This code was taken from the CMake wiki, not from WebM.
IF(MSVC AND PCRE2_STATIC) IF(MSVC AND PCRE2_STATIC_RUNTIME)
MESSAGE(STATUS "** MSVC and PCRE2_STATIC: modifying compiler flags to use static runtime library") MESSAGE(STATUS "** MSVC and PCRE2_STATIC_RUNTIME: modifying compiler flags to use static runtime library")
foreach(flag_var foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endforeach() endforeach()
ENDIF(MSVC AND PCRE2_STATIC) ENDIF(MSVC AND PCRE2_STATIC_RUNTIME)
# Build setup # Build setup

View File

@ -86,8 +86,10 @@ actually affect anything, by sheer luck.
"const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for "const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
older MSVC compilers. older MSVC compilers.
19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC 19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
static compilation. static compilation. Subsequently applied Chris Wilson's second patch, putting
the first patch under a new option instead of being unconditional when
PCRE_STATIC is set.
20. Updated pcre2grep to set stdout as binary when run under Windows, so as not 20. Updated pcre2grep to set stdout as binary when run under Windows, so as not
to convert \r\n at the ends of reflected lines into \r\r\n. This required to convert \r\n at the ends of reflected lines into \r\r\n. This required