aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
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)