@ -40,6 +40,8 @@ else (BUILD_SHARED_LIBS)
endif ( BUILD_SHARED_LIBS )
option ( protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${ protobuf_BUILD_SHARED_LIBS_DEFAULT } )
include ( CMakeDependentOption )
cmake_dependent_option ( protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
" N O T p r o t o b u f _ B U I L D _ S H A R E D _ L I B S " O F F )
set ( protobuf_WITH_ZLIB_DEFAULT ON )
option ( protobuf_WITH_ZLIB "Build with zlib support" ${ protobuf_WITH_ZLIB_DEFAULT } )
set ( protobuf_DEBUG_POSTFIX "d"
@ -153,22 +155,22 @@ if (protobuf_BUILD_SHARED_LIBS)
set ( protobuf_SHARED_OR_STATIC "SHARED" )
else ( protobuf_BUILD_SHARED_LIBS )
set ( protobuf_SHARED_OR_STATIC "STATIC" )
# I n c a s e w e a r e b u i l d i n g s t a t i c l i b r a r i e s , l i n k a l s o t h e r u n t i m e l i b r a r y s t a t i c a l l y
# s o t h a t M S V C R * . D L L i s n o t r e q u i r e d a t r u n t i m e .
# h t t p s : / / m s d n . m i c r o s o f t . c o m / e n - u s / l i b r a r y / 2 k z t 1 w y 3 . a s p x
# T h i s i s a c h i e v e d b y r e p l a c i n g m s v c o p t i o n / M D w i t h / M T a n d / M D d w i t h / M T d
# h t t p : / / w w w . c m a k e . o r g / W i k i / C M a k e _ F A Q # H o w _ c a n _ I _ b u i l d _ m y _ M S V C _ a p p l i c a t i o n _ w i t h _ a _ s t a t i c _ r u n t i m e . 3 F
if ( MSVC AND protobuf_MSVC_STATIC_RUNTIME )
foreach ( flag_var
C M A K E _ C X X _ F L A G S C M A K E _ C X X _ F L A G S _ D E B U G C M A K E _ C X X _ F L A G S _ R E L E A S E
C M A K E _ C X X _ F L A G S _ M I N S I Z E R E L C M A K E _ C X X _ F L A G S _ R E L W I T H D E B I N F O )
if ( ${ flag_var } MATCHES "/MD" )
string ( REGEX REPLACE "/MD" "/MT" ${ flag_var } "${${flag_var}}" )
endif ( ${ flag_var } MATCHES "/MD" )
endforeach ( flag_var )
endif ( MSVC AND protobuf_MSVC_STATIC_RUNTIME )
endif ( protobuf_BUILD_SHARED_LIBS )
# I n c a s e w e a r e l i n k i n g t h e r u n t i m e l i b r a r y s t a t i c a l l y s o t h a t M S V C R * . D L L i s n o t r e q u i r e d a t r u n t i m e .
# h t t p s : / / m s d n . m i c r o s o f t . c o m / e n - u s / l i b r a r y / 2 k z t 1 w y 3 . a s p x
# T h i s i s a c h i e v e d b y r e p l a c i n g m s v c o p t i o n / M D w i t h / M T a n d / M D d w i t h / M T d
# h t t p : / / w w w . c m a k e . o r g / W i k i / C M a k e _ F A Q # H o w _ c a n _ I _ b u i l d _ m y _ M S V C _ a p p l i c a t i o n _ w i t h _ a _ s t a t i c _ r u n t i m e . 3 F
if ( MSVC AND protobuf_MSVC_STATIC_RUNTIME )
foreach ( flag_var
C M A K E _ C X X _ F L A G S C M A K E _ C X X _ F L A G S _ D E B U G C M A K E _ C X X _ F L A G S _ R E L E A S E
C M A K E _ C X X _ F L A G S _ M I N S I Z E R E L C M A K E _ C X X _ F L A G S _ R E L W I T H D E B I N F O )
if ( ${ flag_var } MATCHES "/MD" )
string ( REGEX REPLACE "/MD" "/MT" ${ flag_var } "${${flag_var}}" )
endif ( ${ flag_var } MATCHES "/MD" )
endforeach ( flag_var )
endif ( MSVC AND protobuf_MSVC_STATIC_RUNTIME )
if ( MSVC )
# B u i l d w i t h m u l t i p l e p r o c e s s e s
add_definitions ( /MP )