Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Simple build fixes for MinGW #39

Open
wants to merge 1 commit into from

3 participants

@mbarbon

No description provided.

@lamont-granquist

paging @lloyd this is still needed on a base mingw install using gcc without the microsoft compiler and fixes the build.

@mewalig

@mbarbon this fix worked great, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 26, 2011
  1. @mbarbon

    MinGW compilation fixes.

    mbarbon authored
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 5 deletions.
  1. +14 −5 CMakeLists.txt
  2. +4 −0 src/yajl_tree.c
View
19 CMakeLists.txt
@@ -29,9 +29,13 @@ ENDIF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
IF (WIN32)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
ADD_DEFINITIONS(-DWIN32)
- SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+ ELSE(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
+ SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_EXE_LINKER_FLAGS "${linkFlags}"
CACHE STRING "YAJL linker flags" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ""
@@ -43,9 +47,14 @@ IF (WIN32)
SET(CMAKE_MODULE_LINKER_FLAGS "${linkFlags}"
CACHE STRING "YAJL module linker flags" FORCE)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711")
- SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7")
- SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2")
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -O0 -g")
+ SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2")
+ ELSE(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711")
+ SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7")
+ SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2")
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)
ELSE (WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
IF(CMAKE_COMPILER_IS_GNUCC)
View
4 src/yajl_tree.c
@@ -26,7 +26,11 @@
#include "yajl_parser.h"
#ifdef WIN32
+#ifdef _MSC_VER
#define snprintf sprintf_s
+#else
+#define snprintf _snprintf
+#endif
#endif
#define STATUS_CONTINUE 1
Something went wrong with that request. Please try again.