--- protobuf-3.6.1.3/cmake/CMakeLists.txt.orig	2018-12-27 12:50:56.986667800 +0300
+++ protobuf-3.6.1.3/cmake/CMakeLists.txt	2018-12-27 12:55:31.984950900 +0300
@@ -219,6 +219,20 @@
   configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
 endif (MSVC)
 
+if (MINGW)
+  # Allow big object
+  add_definitions("-Wa,-mbig-obj")
+  string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
+  string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
+  string(REPLACE "." ","  protobuf_RC_FILEVERSION "${protobuf_VERSION}")
+  # Configure Resource Compiler
+  set(CMAKE_RC_COMPILER_INIT windres)
+  enable_language(RC)
+  # fix rc.exe invocations because of usage of add_definitions()
+  set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -i <SOURCE> -o <OBJECT>")
+
+  configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
+endif()
 
 get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
 
