blob: 5a31ab3d2429e7c257dd892bc63beb546a08e491 [file] [log] [blame]
Jan Tattermusch51407912017-02-02 20:44:22 +01001option(gRPC_MSVC_STATIC_RUNTIME "Link with static msvc runtime libraries" OFF)
2
3if(gRPC_MSVC_STATIC_RUNTIME)
4 # switch from dynamic to static linking of msvcrt
5 foreach(flag_var
6 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
7 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
8
9 if(${flag_var} MATCHES "/MD")
10 string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
11 endif(${flag_var} MATCHES "/MD")
12 endforeach(flag_var)
13endif()
14