@@ -242,12 +242,12 @@ endif (protobuf_BUILD_SHARED_LIBS)
242242if (MSVC )
243243 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
244244 # Build with multiple processes
245- add_definitions (/MP)
245+ add_compile_options (/MP)
246246 endif ()
247247 # Set source file and execution character sets to UTF-8
248- add_definitions (/utf-8)
248+ add_compile_options (/utf-8)
249249 # MSVC warning suppressions
250- add_definitions (
250+ add_compile_options (
251251 /wd4065 # switch statement contains 'default' but no 'case' labels
252252 /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data
253253 /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
@@ -262,23 +262,17 @@ if (MSVC)
262262 /wd4996 # The compiler encountered a deprecated declaration.
263263 )
264264 # Allow big object
265- add_definitions (/bigobj)
265+ add_compile_options (/bigobj)
266266 string (REPLACE "/" "\\ " PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR} )
267267 string (REPLACE "/" "\\ " PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR} )
268268 string (REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION} " )
269269 configure_file (${protobuf_SOURCE_DIR} /cmake/extract_includes.bat.in extract_includes.bat)
270270
271271 # Suppress linker warnings about files with no symbols defined.
272- set ( CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221" )
272+ string ( APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221" )
273273
274- if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
275- # Configure Resource Compiler
276- enable_language (RC)
277- # use English language (0x409) in resource compiler
278- set (rc_flags "/l0x409" )
279- # fix rc.exe invocations because of usage of add_definitions()
280- set (CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>" )
281- endif ()
274+ # use English language (0x409) in resource compiler
275+ string (APPEND CMAKE_RC_FLAGS " -l0x409" )
282276
283277 # Generate the version.rc file used elsewhere.
284278 configure_file (${protobuf_SOURCE_DIR} /cmake/version .rc.in ${CMAKE_CURRENT_BINARY_DIR} /version .rc @ONLY)
0 commit comments