From 47161ba38c024a3ccb6d652a9a538b779ea6cfbc Mon Sep 17 00:00:00 2001 From: ph10 Date: Tue, 1 Mar 2016 12:02:58 +0000 Subject: Apply supplied patch for MSVC static compilation. git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@504 6239d852-aaf2-0410-a92c-79f79f948069 --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'CMakeLists.txt') 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) -- cgit v1.2.1