aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2014-04-30 12:05:07 +0300
committerPetri Lehtinen <petri@digip.org>2014-04-30 12:05:51 +0300
commitdb285b37649ffffabbb767029d4ca83af2e6f83d (patch)
tree25570470a635176ba447a1b23fb58bf776467ce4 /CMakeLists.txt
parent960ead07f2d9d7c3b709273eebe2b0556826111a (diff)
downloadjansson-db285b37649ffffabbb767029d4ca83af2e6f83d.zip
jansson-db285b37649ffffabbb767029d4ca83af2e6f83d.tar.gz
jansson-db285b37649ffffabbb767029d4ca83af2e6f83d.tar.bz2
Check uint16_t and uint8_t support correctly
Fixes #177.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 28 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7be3f0..82f397b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,10 +149,12 @@ else ()
message (FATAL_ERROR "Could not detect a valid 32-bit integer type")
endif ()
-check_type_size (uint32_t UINT32_T)
-check_type_size (__uint32 __UINT32)
check_type_size ("unsigned long" UNSIGNED_LONG_INT)
check_type_size ("unsigned int" UNSIGNED_INT)
+check_type_size ("unsigned short" UNSIGNED_SHORT)
+
+check_type_size (uint32_t UINT32_T)
+check_type_size (__uint32 __UINT32)
if (HAVE_UINT32_T)
set (JSON_UINT32 uint32_t)
elseif (HAVE___UINT32)
@@ -165,6 +167,30 @@ else ()
message (FATAL_ERROR "Could not detect a valid unsigned 32-bit integer type")
endif ()
+check_type_size (uint16_t UINT16_T)
+check_type_size (__uint16 __UINT16)
+if (HAVE_UINT16_T)
+ set (JSON_UINT16 uint16_t)
+elseif (HAVE___UINT16)
+ set (JSON_UINT16 __uint16)
+elseif (HAVE_UNSIGNED_INT AND (${UNSIGNED_INT} EQUAL 2))
+ set (JSON_UINT16 "unsigned int")
+elseif (HAVE_UNSIGNED_SHORT AND (${UNSIGNED_SHORT} EQUAL 2))
+ set (JSON_UINT16 "unsigned short")
+else ()
+ message (FATAL_ERROR "Could not detect a valid unsigned 16-bit integer type")
+endif ()
+
+check_type_size (uint8_t UINT8_T)
+check_type_size (__uint8 __UINT8)
+if (HAVE_UINT8_T)
+ set (JSON_UINT8 uint8_t)
+elseif (HAVE___UINT8)
+ set (JSON_UINT8 __uint8)
+else ()
+ set (JSON_UINT8 "unsigned char")
+endif ()
+
# Check for ssize_t and SSIZE_T existance.
check_type_size(ssize_t SSIZE_T)
check_type_size(SSIZE_T UPPERCASE_SSIZE_T)