Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple build fixes for MinGW #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 14 additions & 5 deletions CMakeLists.txt
Expand Up @@ -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 ""
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/yajl_tree.c
Expand Up @@ -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
Expand Down