From 3d5bea57148d62c313bc9519644fd6858ba79b05 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Thu, 7 Jun 2012 23:07:04 +0800 Subject: [PATCH] Fixes for cmake for MSVC2010 --- CMakeLists.txt | 6 +++--- config.h.cmake | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 696b276..07aab7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,14 +74,14 @@ check_type_size (__int32 __INT32) check_type_size ("long" LONG_INT) check_type_size ("int" INT) -if (HAVE___INT32) +if (HAVE_INT32_T) + set (JSON_INT32 int32_t) +elseif (HAVE___INT32) set (JSON_INT32 __int32) elseif (HAVE_LONG AND (${LONG_INT} EQUAL 4)) set (JSON_INT32 long) elseif (HAVE_INT AND (${INT} EQUAL 4)) set (JSON_INT32 int) -elseif (HAVE_INT32_T) - set (JSON_INT32 int32_t) else () message (FATAL_ERROR "Could not detect a valid 32 bit integer type") endif () diff --git a/config.h.cmake b/config.h.cmake index c4e5a33..6f854ec 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,7 +1,20 @@ /* Reduced down to the defines that are actually used in the code */ -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have the (and friends) header file. */ #cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* We must include this here, as in (eg) utf.h it will want to use + the integer type, which in MSVC2010 will be in stdint.h + (there is no inttypes.h in MSVC2010) */ +#if defined(HAVE_STDINT_H) +# include +#elif defined(HAVE_INTTYPES_H) +# include +#elif defined(HAVE_SYS_TYPES_H) +# include +#endif /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LOCALE_H 1