From 6dfebfdbcd3478d4529b9858039cdc81fd4c02ea Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 7 Jan 2002 14:07:32 -0500 Subject: [PATCH] Add sizeof some types support --- .../CMakeBorlandWindowsSystemConfig.cmake | 9 ++++++++ Templates/CMakeNMakeWindowsSystemConfig.cmake | 9 ++++++++ Templates/CMakeSystemConfig.cmake.in | 8 +++++++ Templates/CMakeWindowsSystemConfig.cmake | 13 ++++++++++- Templates/configure.in | 22 +++++++++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Templates/CMakeBorlandWindowsSystemConfig.cmake b/Templates/CMakeBorlandWindowsSystemConfig.cmake index af2cf1a8b..5e3500c59 100644 --- a/Templates/CMakeBorlandWindowsSystemConfig.cmake +++ b/Templates/CMakeBorlandWindowsSystemConfig.cmake @@ -80,6 +80,15 @@ SET (CMAKE_MODULE_SUFFIX ".dll" CACHE STRING FIND_PROGRAM(CMAKE_MAKE_PROGRAM make ${BCB_BIN_PATH}) +# We will hardcode them for now. Make sure to fix that in the future +SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") +SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") +SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") +SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") +SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") +SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") +SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") + MARK_AS_ADVANCED( CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO diff --git a/Templates/CMakeNMakeWindowsSystemConfig.cmake b/Templates/CMakeNMakeWindowsSystemConfig.cmake index a960f7c8d..ad36106e2 100644 --- a/Templates/CMakeNMakeWindowsSystemConfig.cmake +++ b/Templates/CMakeNMakeWindowsSystemConfig.cmake @@ -24,6 +24,15 @@ SET (CMAKE_STATICLIB_SUFFIX ".lib" CACHE STRING SET (CMAKE_ANSI_CFLAGS "" CACHE INTERNAL "What flags are required by the c++ compiler to make it ansi.") +# We will hardcode them for now. Make sure to fix that in the future +SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") +SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") +SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") +SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") +SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") +SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") +SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") + # Build type SET (CMAKE_BUILD_TYPE Debug CACHE STRING diff --git a/Templates/CMakeSystemConfig.cmake.in b/Templates/CMakeSystemConfig.cmake.in index 42f8a3e0d..ee1513559 100644 --- a/Templates/CMakeSystemConfig.cmake.in +++ b/Templates/CMakeSystemConfig.cmake.in @@ -119,6 +119,14 @@ SET (CMAKE_ANSI_CXXFLAGS @CMAKE_ANSI_CXXFLAGS@ CACHE INTERNAL SET (CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION @CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION@ CACHE INTERNAL "Does the compiler not support explicit template instantiation.") +SET (CMAKE_SIZEOF_INT @CMAKE_SIZEOF_INT@ CACHE INTERNAL "Size of int data type") +SET (CMAKE_SIZEOF_LONG @CMAKE_SIZEOF_LONG@ CACHE INTERNAL "Size of long data type") +SET (CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@ CACHE INTERNAL "Size of void* data type") +SET (CMAKE_SIZEOF_CHAR @CMAKE_SIZEOF_CHAR@ CACHE INTERNAL "Size of char data type") +SET (CMAKE_SIZEOF_SHORT @CMAKE_SIZEOF_SHORT@ CACHE INTERNAL "Size of short data type") +SET (CMAKE_SIZEOF_FLOAT @CMAKE_SIZEOF_FLOAT@ CACHE INTERNAL "Size of float data type") +SET (CMAKE_SIZEOF_DOUBLE @CMAKE_SIZEOF_DOUBLE@ CACHE INTERNAL "Size of double data type") + FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make ) # The following variables are advanced diff --git a/Templates/CMakeWindowsSystemConfig.cmake b/Templates/CMakeWindowsSystemConfig.cmake index 7892a8968..ec093dd2c 100644 --- a/Templates/CMakeWindowsSystemConfig.cmake +++ b/Templates/CMakeWindowsSystemConfig.cmake @@ -25,6 +25,15 @@ SET (CMAKE_USE_WIN32_THREADS 1 CACHE BOOL SET (CMAKE_MAKE_PROGRAM "msdev" CACHE STRING "Program used to build from dsp files.") +# We will hardcode them for now. Make sure to fix that in the future +SET (CMAKE_SIZEOF_INT 4 CACHE INTERNAL "Size of int data type") +SET (CMAKE_SIZEOF_LONG 4 CACHE INTERNAL "Size of long data type") +SET (CMAKE_SIZEOF_VOID_P 4 CACHE INTERNAL "Size of void* data type") +SET (CMAKE_SIZEOF_CHAR 1 CACHE INTERNAL "Size of char data type") +SET (CMAKE_SIZEOF_SHORT 2 CACHE INTERNAL "Size of short data type") +SET (CMAKE_SIZEOF_FLOAT 4 CACHE INTERNAL "Size of float data type") +SET (CMAKE_SIZEOF_DOUBLE 8 CACHE INTERNAL "Size of double data type") + # The following variables are advanced MARK_AS_ADVANCED( @@ -38,4 +47,6 @@ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_DEBUG CMAKE_USE_WIN32_THREADS CMAKE_MAKE_PROGRAM -) \ No newline at end of file +) + + diff --git a/Templates/configure.in b/Templates/configure.in index 3143a21a2..4179abddb 100644 --- a/Templates/configure.in +++ b/Templates/configure.in @@ -12,6 +12,28 @@ AC_PROG_CXX AC_PROG_RANLIB AC_PROG_INSTALL +AC_CHECK_SIZEOF(int, 4) +CMAKE_SIZEOF_INT=$ac_cv_sizeof_int +AC_SUBST(CMAKE_SIZEOF_INT) +AC_CHECK_SIZEOF(long, 4) +CMAKE_SIZEOF_LONG=$ac_cv_sizeof_long +AC_SUBST(CMAKE_SIZEOF_LONG) +AC_CHECK_SIZEOF(void *, 4) +CMAKE_SIZEOF_VOID_P=$ac_cv_sizeof_void_p +AC_SUBST(CMAKE_SIZEOF_VOID_P) +AC_CHECK_SIZEOF(char, 1) +CMAKE_SIZEOF_CHAR=$ac_cv_sizeof_char +AC_SUBST(CMAKE_SIZEOF_CHAR) +AC_CHECK_SIZEOF(short, 2) +CMAKE_SIZEOF_SHORT=$ac_cv_sizeof_short +AC_SUBST(CMAKE_SIZEOF_SHORT) +AC_CHECK_SIZEOF(float, 4) +CMAKE_SIZEOF_FLOAT=$ac_cv_sizeof_float +AC_SUBST(CMAKE_SIZEOF_FLOAT) +AC_CHECK_SIZEOF(double, 8) +CMAKE_SIZEOF_DOUBLE=$ac_cv_sizeof_double +AC_SUBST(CMAKE_SIZEOF_DOUBLE) + # check for X11 support AC_PATH_XTRA CMAKE_HAS_X=0