From d5e70c93d9be4e138bb26a6f78452466ff6b8cb5 Mon Sep 17 00:00:00 2001 From: Brian Sidebotham Date: Mon, 23 Feb 2015 21:08:11 +0000 Subject: [PATCH] * Make sure MinGW uses ANSI C99/C++ stdio snprintf --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 921cc0bbc6..1d7b8f3641 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,6 +223,11 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) endif() endif() + # The MinGW compiler can use the microsoft system snprintf as standard and it has a broken + # API with respect to the C99 standard, so make sure we force it to use its own compliant + # snprintf + add_definitions(-D__USE_MINGW_ANSI_STDIO=1) + else() # We build DLL/DSOs from static libraries, so create position independent # code for all cases, since we do not have DLL/DSO specific static