1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 00:04:06 +00:00

Fix MinGW build (still produces lots of useless warnings though)

This commit is contained in:
Mike Gelfand 2015-12-31 12:41:17 +00:00
parent 40f3de0572
commit 7ea2b71ec8
2 changed files with 18 additions and 1 deletions

View file

@ -142,6 +142,10 @@ if(WIN32)
# Reduce noise (at least for now)
set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} /wd4244 /wd4267")
endif()
if(MINGW)
set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} -D__USE_MINGW_ANSI_STDIO=1")
endif()
endforeach()
endif()
@ -310,7 +314,8 @@ set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party)
if(WIN32)
tr_add_external_auto_library(EVENT2 event
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${THIRD_PARTY_DIR}/event2.cmake" "<SOURCE_DIR>/CMakeLists.txt"
COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 -i "${THIRD_PARTY_DIR}/event2-01-win32.patch")
COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 -i "${THIRD_PARTY_DIR}/event2-01-win32.patch"
COMMAND "${CMAKE_COMMAND}" -E chdir "<SOURCE_DIR>" patch -p1 -i "${THIRD_PARTY_DIR}/event2-02-win32.patch")
else()
tr_add_external_auto_library(EVENT2 event
BUILD_IN_SOURCE 1

12
third-party/event2-02-win32.patch vendored Normal file
View file

@ -0,0 +1,12 @@
diff --git a/evutil.c b/evutil.c
--- a/evutil.c
+++ b/evutil.c
@@ -1562,7 +1562,7 @@
int r;
if (!buflen)
return 0;
-#if defined(_MSC_VER) || defined(WIN32)
+#if (defined(_MSC_VER) && _MSC_VER < 1900) || (defined(WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || (__USE_MINGW_ANSI_STDIO + 0) == 0))
r = _vsnprintf(buf, buflen, format, ap);
if (r < 0)
r = _vscprintf(format, ap);