Commit ea1467d0 authored by Brad King's avatar Brad King

ENH: Renamed Modules/CheckSizeOf to Modules/CheckTypeSize for consistency with...

ENH: Renamed Modules/CheckSizeOf to Modules/CheckTypeSize for consistency with the macro name that is defined by the module.
parent 6e4712d6
......@@ -9,7 +9,7 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
......
#
# Check if the type exists and determine size of type. if the type
# exists, the size will be stored to the variable.
#
# CHECK_TYPE_SIZE - macro which checks the size of type
# VARIABLE - variable to store size if the type exists.
#
MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_TYPE_SIZE_FLAGS -DCHECK_SIZE_OF="${TYPE}")
IF(HAVE_SYS_TYPES_H)
SET(MACRO_CHECK_TYPE_SIZE_FLAGS
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_SYS_TYPES_H")
ENDIF(HAVE_SYS_TYPES_H)
IF(HAVE_STDINT_H)
SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H")
ENDIF(HAVE_STDINT_H)
MESSAGE(STATUS "Check size of ${TYPE}")
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckSizeOf.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - done")
ELSE(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - failed")
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n"
APPEND)
ENDIF(HAVE_${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_TYPE_SIZE)
MESSAGE(SEND_ERROR
"Modules/CheckSizeOf.cmake has been removed. "
"Use Modules/CheckTypeSize.cmake instead. This "
"compatability check may be removed before the next release!")
#ifdef CHECK_SIZE_OF
#ifdef CHECK_TYPE_SIZE_TYPE
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
......@@ -10,11 +10,11 @@
int main()
{
return sizeof(CHECK_SIZE_OF);
return sizeof(CHECK_TYPE_SIZE_TYPE);
}
#else /* CHECK_SIZE_OF */
#else /* CHECK_TYPE_SIZE_TYPE */
# error "CHECK_SIZE_OF has to specify the type"
# error "CHECK_TYPE_SIZE_TYPE has to specify the type"
#endif /* CHECK_SIZE_OF */
#endif /* CHECK_TYPE_SIZE_TYPE */
#
# Check if the type exists and determine size of type. if the type
# exists, the size will be stored to the variable.
#
# CHECK_TYPE_SIZE - macro which checks the size of type
# VARIABLE - variable to store size if the type exists.
#
MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_TYPE_SIZE_FLAGS -DCHECK_TYPE_SIZE_TYPE="${TYPE}")
IF(HAVE_SYS_TYPES_H)
SET(MACRO_CHECK_TYPE_SIZE_FLAGS
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_SYS_TYPES_H")
ENDIF(HAVE_SYS_TYPES_H)
IF(HAVE_STDINT_H)
SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H")
ENDIF(HAVE_STDINT_H)
MESSAGE(STATUS "Check size of ${TYPE}")
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckTypeSize.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - done")
ELSE(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - failed")
WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n"
APPEND)
ENDIF(HAVE_${VARIABLE})
ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
ENDMACRO(CHECK_TYPE_SIZE)
......@@ -3,7 +3,7 @@ PROJECT(LoadedCommand)
# set a definition
SET (TEST_COMMAND_TEST1 1)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
CHECK_TYPE_SIZE(char SIZEOF_CHAR)
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
......
......@@ -3,7 +3,7 @@ PROJECT(LoadedCommand)
# set a definition
SET (TEST_COMMAND_TEST1 1)
INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
CHECK_TYPE_SIZE(char SIZEOF_CHAR)
INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment