Apply supplied patch for MSVC static compilation.

This commit is contained in:
Philip.Hazel 2016-03-01 12:02:58 +00:00
parent 0cfea16397
commit dd76a5938d
2 changed files with 16 additions and 0 deletions

View File

@ -71,6 +71,7 @@
# 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-10=16 PH added support for never-backslash-C
# 2016-03-01 PH appliced Chris Wilson's patch for MSVC static
PROJECT(PCRE2 C)
@ -456,6 +457,18 @@ SET(PCRE2POSIX_SOURCES
ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
ENDIF(MSVC AND NOT PCRE2_STATIC)
# 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.
IF(MSVC AND PCRE2_STATIC)
MESSAGE(STATUS "** MSVC and PCRE2_STATIC: modifying compiler flags to use static runtime library")
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endforeach()
ENDIF(MSVC AND PCRE2_STATIC)
# Build setup
ADD_DEFINITIONS(-DHAVE_CONFIG_H)

View File

@ -86,6 +86,9 @@ actually affect anything, by sheer luck.
"const" qualifiers in pcre2test and (b) defining snprintf as _snprintf for
older MSVC compilers.
19. Applied Chris Wilson's patch (Bugzilla #1681) to CMakeLists.txt for MSVC
static compilation.
Version 10.21 12-January-2016
-----------------------------