Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
38a56ee4
Commit
38a56ee4
authored
Aug 12, 2015
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #702 from jtattermusch/visual_studio_build_static_runtime
Link runtime statically for VS build
parents
edaefac5
9bdeba47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
CMakeLists.txt
cmake/CMakeLists.txt
+13
-0
No files found.
cmake/CMakeLists.txt
View file @
38a56ee4
...
@@ -43,6 +43,19 @@ endif (HAVE_ZLIB)
...
@@ -43,6 +43,19 @@ 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
)
else
(
BUILD_SHARED_LIBS
)
# In case we are building static libraries, link also the runtime library statically
# so that MSVCR*.DLL is not required at runtime.
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
# 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
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
(
BUILD_SHARED_LIBS
)
endif
(
BUILD_SHARED_LIBS
)
add_definitions
(
/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305
)
add_definitions
(
/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305
)
endif
(
MSVC
)
endif
(
MSVC
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment