[Pcre-svn] [504] code/trunk: Apply supplied patch for MSVC s…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [504] code/trunk: Apply supplied patch for MSVC static compilation.
Revision: 504
          http://www.exim.org/viewvc/pcre2?view=rev&revision=504
Author:   ph10
Date:     2016-03-01 12:02:58 +0000 (Tue, 01 Mar 2016)
Log Message:
-----------
Apply supplied patch for MSVC static compilation.


Modified Paths:
--------------
    code/trunk/CMakeLists.txt
    code/trunk/ChangeLog


Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt    2016-02-29 18:31:30 UTC (rev 503)
+++ code/trunk/CMakeLists.txt    2016-03-01 12:02:58 UTC (rev 504)
@@ -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 @@
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)

Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-02-29 18:31:30 UTC (rev 503)
+++ code/trunk/ChangeLog    2016-03-01 12:02:58 UTC (rev 504)
@@ -86,7 +86,10 @@
 "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
-----------------------------