summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2016-03-01 12:02:58 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2016-03-01 12:02:58 +0000
commit47161ba38c024a3ccb6d652a9a538b779ea6cfbc (patch)
tree473cf0e342e9e66f0f57e549f3cedcb729c0a4d2
parent0ff3dcb6b4af54cccc4f222fcff59311b51a6854 (diff)
downloadpcre2-47161ba38c024a3ccb6d652a9a538b779ea6cfbc.tar.gz
Apply supplied patch for MSVC static compilation.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@504 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--CMakeLists.txt13
-rw-r--r--ChangeLog3
2 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c84b05..3df4af0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/ChangeLog b/ChangeLog
index cb79e05..717f277 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
-----------------------------