forked from osmocom/wireshark
MinGW-w64: Need to use ANSI C stdio
Defining _POSIX enables __USE_MINGW_ANSI_STDIO, this switches the stdio API from Microsoft to MinGW internal (ANSI C).
This commit is contained in:
parent
8d59f81729
commit
6921f01250
|
@ -464,6 +464,16 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
add_definitions(
|
||||
#
|
||||
# Enable POSIX APIs. This will switch stdio to ANSI C functions and
|
||||
# enable C99 conformant vsnprintf() among other things.
|
||||
#
|
||||
-D_POSIX
|
||||
)
|
||||
endif()
|
||||
|
||||
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
if ((MSVC_VERSION LESS "1900") OR (MSVC_VERSION GREATER_EQUAL "2000"))
|
||||
message(FATAL_ERROR "You are using an unsupported version of MSVC")
|
||||
|
|
|
@ -107,6 +107,10 @@ check_symbol_exists(tzname "time.h" HAVE_TZNAME)
|
|||
# Check if the libc vsnprintf() conforms to C99. If this fails we may
|
||||
# need to fall-back on GLib I/O.
|
||||
#
|
||||
cmake_push_check_state(RESET)
|
||||
if(MINGW)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D__USE_MINGW_ANSI_STDIO)
|
||||
endif()
|
||||
check_c_source_runs("
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
|
@ -120,6 +124,7 @@ check_c_source_runs("
|
|||
}"
|
||||
HAVE_C99_VSNPRINTF
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
if (NOT HAVE_C99_VSNPRINTF)
|
||||
message(FATAL_ERROR
|
||||
"Building Wireshark requires a C99 compliant vsnprintf() and this \
|
||||
|
|
Loading…
Reference in New Issue