@@ -247,12 +247,12 @@ endif (protobuf_BUILD_SHARED_LIBS)
247247if (MSVC )
248248 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
249249 # Build with multiple processes
250- add_definitions (/MP )
250+ add_compile_options (/MP )
251251 endif ()
252252 # Set source file and execution character sets to UTF-8
253- add_definitions (/utf-8 )
253+ add_compile_options (/utf-8 )
254254 # MSVC warning suppressions
255- add_definitions (
255+ add_compile_options (
256256 /wd4065 # switch statement contains 'default' but no 'case' labels
257257 /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
258258 /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
@@ -267,22 +267,16 @@ if (MSVC)
267267 /wd4996 # The compiler encountered a deprecated declaration.
268268 )
269269 # Allow big object
270- add_definitions (/bigobj )
270+ add_compile_options (/bigobj )
271271 string (REPLACE "/" "\\ " PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR} )
272272 string (REPLACE "/" "\\ " PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR} )
273273 string (REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION} " )
274274
275275 # Suppress linker warnings about files with no symbols defined.
276- set ( CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221" )
276+ string ( APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221" )
277277
278- if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
279- # Configure Resource Compiler
280- enable_language (RC )
281- # use English language (0x409) in resource compiler
282- set (rc_flags "/l0x409" )
283- # fix rc.exe invocations because of usage of add_definitions()
284- set (CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>" )
285- endif ()
278+ # use English language (0x409) in resource compiler
279+ string (APPEND CMAKE_RC_FLAGS " -l0x409" )
286280
287281 # Generate the version.rc file used elsewhere.
288282 configure_file (${protobuf_SOURCE_DIR} /cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR} /version.rc @ONLY )
0 commit comments