cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
+set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
project(zlib C)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
+elseif(MSYS)
+ # Suppress version number from shared library name
+ set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0)
elseif(BUILD_SHARED_LIBS AND WIN32)
# Creates zlib1.dll when building shared library version
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
# include <io.h>
#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__)
# define WIDECHAR
#endif
#endif
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-#if !defined(STDC99) && !defined(__CYGWIN__) && defined(WIN32)
+#if !defined(STDC99) && !defined(__CYGWIN__) && !defined(__MINGW__) && defined(WIN32)
# if !defined(vsnprintf)
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# define vsnprintf _vsnprintf
/* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : (
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__MINGW__)
fd == -2 ? _wopen(path, oflag, 0666) :
#elif __CYGWIN__
fd == -2 ? open(state->path, oflag, 0666) :
ZEXTERN int ZEXPORT deflateResetKeep(z_stream *);
#ifdef WITH_GZFILEOP
-# if (defined(_WIN32) || defined(__CYGWIN__))
+# if (defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__))
ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode);
# endif
ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va);