|
|
@ -43,20 +43,21 @@ endif (HAVE_ZLIB) |
|
|
|
if (MSVC) |
|
|
|
if (MSVC) |
|
|
|
if (BUILD_SHARED_LIBS) |
|
|
|
if (BUILD_SHARED_LIBS) |
|
|
|
add_definitions(-DPROTOBUF_USE_DLLS) |
|
|
|
add_definitions(-DPROTOBUF_USE_DLLS) |
|
|
|
endif (BUILD_SHARED_LIBS) |
|
|
|
else (BUILD_SHARED_LIBS) |
|
|
|
add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) |
|
|
|
# In case we are building static libraries, link also the runtime library statically |
|
|
|
|
|
|
|
# so that MSVCR*.DLL is not required at runtime. |
|
|
|
# Link runtime library statically so that MSVCR*.DLL is not required at runtime. |
|
|
|
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx |
|
|
|
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx |
|
|
|
# This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd |
|
|
|
# This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd |
|
|
|
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F |
|
|
|
# http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F |
|
|
|
foreach(flag_var |
|
|
|
foreach(flag_var |
|
|
|
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
|
|
|
if(${flag_var} MATCHES "/MD") |
|
|
|
if(${flag_var} MATCHES "/MD") |
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") |
|
|
|
endif(${flag_var} MATCHES "/MD") |
|
|
|
endif(${flag_var} MATCHES "/MD") |
|
|
|
endforeach(flag_var) |
|
|
|
endforeach(flag_var) |
|
|
|
|
|
|
|
endif (BUILD_SHARED_LIBS) |
|
|
|
|
|
|
|
add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) |
|
|
|
endif (MSVC) |
|
|
|
endif (MSVC) |
|
|
|
|
|
|
|
|
|
|
|
if (MSVC) |
|
|
|
if (MSVC) |
|
|
|