diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2016-03-01 12:02:58 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2016-03-01 12:02:58 +0000 |
commit | 47161ba38c024a3ccb6d652a9a538b779ea6cfbc (patch) | |
tree | 473cf0e342e9e66f0f57e549f3cedcb729c0a4d2 /CMakeLists.txt | |
parent | 0ff3dcb6b4af54cccc4f222fcff59311b51a6854 (diff) | |
download | pcre2-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
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 13 |
1 files changed, 13 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) |