Skip to content

Commit 0887b58

Browse files
committed
Use C99 stdio in mingw-w64
MinGW >= 3.14 does this automatically, but mingw-64 wants us to define it.
1 parent 92ebbe9 commit 0887b58

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ ELSE ()
205205

206206
IF (MINGW) # MinGW always does PIC and complains if we tell it to
207207
STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
208+
# MinGW >= 3.14 uses the C99-style stdio functions
209+
# automatically, but forks like mingw-w64 still want
210+
# us to define this in order to use them
211+
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
212+
208213
ELSEIF (BUILD_SHARED_LIBS)
209214
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fPIC")
210215
ENDIF ()

0 commit comments

Comments
 (0)