--- config/include/dcmtk/config/cfwin32.h	Mon Jan 19 05:14:16 1970
+++ config/include/dcmtk/config/cfwin32.h	Mon Jan 19 05:14:16 1970
@@ -31,0 +32 @@
+/* // disabled for MingGW gcc 4.4
@@ -36,0 +38 @@
+*/
@@ -825,0 +828,7 @@
+#endif
+
+/* Platform specific settings for MinGW
+ */
+#ifdef __MINGW32__
+#define USE_STD_CXX_INCLUDES
+#define HAVE_DECLARATION_STD__IOS_BASE__OPENMODE
--- dcmdata/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmdata/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmdata ofstd wsock32)
+ENDIF(MINGW)
+
--- dcmimage/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmimage/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmimage dcmimgle)
+ENDIF(MINGW)
+
--- dcmimgle/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmimgle/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmimgle dcmdata)
+ENDIF(MINGW)
+
--- dcmjpeg/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmjpeg/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -6,0 +7,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmjpeg dcmimage ijg8 ijg12 ijg16)
+ENDIF(MINGW)
+
--- dcmnet/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmnet/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmnet dcmdata)
+ENDIF(MINGW)
+
--- dcmpstat/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmpstat/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmpstat dcmqrdb dcmimgle dcmdsig dcmtls dcmsr)
+ENDIF(MINGW)
+
--- dcmqrdb/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmqrdb/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmqrdb dcmnet)
+ENDIF(MINGW)
+
--- dcmsign/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmsign/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmdsig dcmdata)
+ENDIF(MINGW)
+
--- dcmsr/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmsr/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmsr dcmdata)
+ENDIF(MINGW)
+
--- dcmtls/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmtls/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmtls dcmnet)
+ENDIF(MINGW)
+
--- dcmwlm/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ dcmwlm/libsrc/CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -3,0 +4,4 @@
+IF(MINGW)
+  TARGET_LINK_LIBRARIES(dcmwlm dcmnet)
+ENDIF(MINGW)
+
--- CMakeLists.txt	Mon Jan 19 05:14:16 1970
+++ CMakeLists.txt	Mon Jan 19 05:14:16 1970
@@ -30 +30,19 @@
-SET(WITH_SHARED_LIBS OFF)
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  # CMake adds --enable-all-exports on Cygwin (since Cygwin is
+  # supposed to be UNIX-like), but we need to add it explicitly for
+  # a native windows build with the MinGW tools.
+  IF(MINGW)
+    SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
+        "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
+    SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS
+        "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import")
+    SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-auto-import")
+  ENDIF(MINGW)
+  IF(CYGWIN)
+    SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-auto-import")
+  ENDIF(CYGWIN)
+  SET(WITH_SHARED_LIBS ON)
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+  SET(WITH_SHARED_LIBS OFF)
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
