Commit 0887b580bfe83a9f6e9a8530368a22e478411a0f

Carlos Martín Nieto 2013-03-08T15:13:25

Use C99 stdio in mingw-w64 MinGW >= 3.14 does this automatically, but mingw-64 wants us to define it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0377543..37a5830 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,6 +205,11 @@ ELSE ()
 
 	IF (MINGW) # MinGW always does PIC and complains if we tell it to
 		STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
+		# MinGW >= 3.14 uses the C99-style stdio functions
+		# automatically, but forks like mingw-w64 still want
+		# us to define this in order to use them
+		ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
+
 	ELSEIF (BUILD_SHARED_LIBS)
 		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fPIC")
 	ENDIF ()