aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-02-06 12:11:16 -0800
committerGravatar Mark D. Roth <roth@google.com>2017-02-06 12:11:16 -0800
commitc6449d9f2b48b7b1259ac7307c6a2e4798d10695 (patch)
treeb4dff4c179cdaea8af4bd906da732f66336c5599 /cmake
parentae89af9cb48a65c67f9d2008615fb7f4f7005c65 (diff)
parentd6d2677637fee5d2988dae08cee1b909d822c650 (diff)
Merge remote-tracking branch 'upstream/master' into canonicalize_server_uri
Diffstat (limited to 'cmake')
-rw-r--r--cmake/msvc_static_runtime.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/msvc_static_runtime.cmake b/cmake/msvc_static_runtime.cmake
new file mode 100644
index 0000000000..5a31ab3d24
--- /dev/null
+++ b/cmake/msvc_static_runtime.cmake
@@ -0,0 +1,14 @@
+option(gRPC_MSVC_STATIC_RUNTIME "Link with static msvc runtime libraries" OFF)
+
+if(gRPC_MSVC_STATIC_RUNTIME)
+ # switch from dynamic to static linking of msvcrt
+ foreach(flag_var
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+
+ if(${flag_var} MATCHES "/MD")
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ endif(${flag_var} MATCHES "/MD")
+ endforeach(flag_var)
+endif()
+