summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-12-17 20:16:13 (GMT)
committerBrad King <brad.king@kitware.com>2009-12-17 20:16:13 (GMT)
commitba7ccc8bf459e2111c7e30c9e5923d3c26f44049 (patch)
treee13c6469eb3b6125cfed41e3ef6f00dc1cebc531 /Utilities
parent5d4a07462de80fea0242e0e983543a13b0d04410 (diff)
downloadCMake-ba7ccc8bf459e2111c7e30c9e5923d3c26f44049.zip
CMake-ba7ccc8bf459e2111c7e30c9e5923d3c26f44049.tar.gz
CMake-ba7ccc8bf459e2111c7e30c9e5923d3c26f44049.tar.bz2
cmcurl: Use arch-aware CHECK_TYPE_SIZE result
Our new CHECK_TYPE_SIZE macro produces a SIZEOF_<type>_CODE value for use in configured headers to get architecture-aware type size results. In this commit we teach cmcurl to use the SIZEOF_<type>_CODE value to get proper configured type sizes in OS X Universal Binaries.
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/cmcurl/CMakeLists.txt38
-rw-r--r--Utilities/cmcurl/config.h.in29
2 files changed, 53 insertions, 14 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 8e7b380..d7ff9aa 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -2,6 +2,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
+IF(CMAKE_OSX_ARCHITECTURES)
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
+ENDIF(CMAKE_OSX_ARCHITECTURES)
PROJECT(LIBCURL C)
# Setup package meta-data
@@ -36,7 +39,12 @@ INCLUDE (CheckIncludeFile)
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckSymbolExists)
-INCLUDE (CheckTypeSize)
+IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4
+ AND CMake_SOURCE_DIR)
+ INCLUDE (${CMake_SOURCE_DIR}/Modules/CheckTypeSize.cmake)
+ELSE()
+ INCLUDE (CheckTypeSize)
+ENDIF()
SET(libCurl_SRCS
# amigaos.c - does not build on AmigaOS
@@ -329,14 +337,6 @@ CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
CHECK_TYPE_SIZE("time_t" SIZEOF_TIME_T)
-IF(NOT HAVE_SIZEOF_SSIZE_T)
- IF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
- SET(ssize_t long)
- ENDIF(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
- IF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
- SET(ssize_t __int64)
- ENDIF(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T)
-ENDIF(NOT HAVE_SIZEOF_SSIZE_T)
IF(HAVE_SIZEOF_LONG_LONG)
SET(HAVE_LONGLONG 1)
@@ -723,6 +723,26 @@ ELSE(CMAKE_BUILD_CURL_SHARED)
-DCURL_STATICLIB)
ENDIF(CMAKE_BUILD_CURL_SHARED)
SET(CURL_STATICLIB)
+
+# Support CheckTypeSize module from CMake 2.8.0 and lower.
+FOREACH(var
+ SIZEOF_CURL_OFF_T
+ SIZEOF_LONG
+ SIZEOF_LONG_LONG
+ SIZEOF___INT64
+ SIZEOF_SIZE_T
+ SIZEOF_TIME_T
+ )
+ IF(NOT ${var}_CODE)
+ MESSAGE("creating ${var}_CODE")
+ IF(${var})
+ SET(${var}_CODE "#define ${var} ${${var}}")
+ ELSE()
+ SET(${var}_CODE "/* #undef ${var} */")
+ ENDIF()
+ ENDIF()
+ENDFOREACH()
+
CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in
${LIBCURL_BINARY_DIR}/config.h)
diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in
index 6f2e5db..e3efdc1 100644
--- a/Utilities/cmcurl/config.h.in
+++ b/Utilities/cmcurl/config.h.in
@@ -640,16 +640,25 @@
#cmakedefine SEND_TYPE_RETV ${SEND_TYPE_RETV}
/* The size of `curl_off_t', as computed by sizeof. */
-#cmakedefine SIZEOF_CURL_OFF_T ${SIZEOF_CURL_OFF_T}
+@SIZEOF_CURL_OFF_T_CODE@
/* The size of `long', as computed by sizeof. */
-#cmakedefine SIZEOF_LONG ${SIZEOF_LONG}
+@SIZEOF_LONG_CODE@
+
+/* The size of `long long', as computed by sizeof. */
+@SIZEOF_LONG_LONG_CODE@
+
+/* The size of `__int64', as computed by sizeof. */
+@SIZEOF___INT64_CODE@
/* The size of `size_t', as computed by sizeof. */
-#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T}
+@SIZEOF_SIZE_T_CODE@
+
+/* The size of `ssize_t', as computed by sizeof. */
+@SIZEOF_SSIZE_T_CODE@
/* The size of `time_t', as computed by sizeof. */
-#cmakedefine SIZEOF_TIME_T ${SIZEOF_TIME_T}
+@SIZEOF_TIME_T_CODE@
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS ${STDC_HEADERS}
@@ -713,7 +722,17 @@
#cmakedefine socklen_t ${socklen_t}
/* the signed version of size_t */
-#cmakedefine ssize_t ${ssize_t}
+#ifndef SIZEOF_SSIZE_T
+# if SIZEOF_LONG == SIZEOF_SIZE_T
+ typedef long ssize_t;
+# elif SIZEOF_LONG_LONG == SIZEOF_SIZE_T
+ typedef long long ssize_t;
+# elif SIZEOF___INT64 == SIZEOF_SIZE_T
+ typedef __int64 ssize_t;
+# else
+ typedef int ssize_t;
+# endif
+#endif
/* Special handling of zlib library */
#cmakedefine CURL_SPECIAL_ZLIB_H "${CURL_SPECIAL_ZLIB_H}"