Improve check size of. Now it checks for some header files before trying to check types

This commit is contained in:
Andy Cedilnik 2002-09-24 16:20:08 -04:00
parent 94ff97ceed
commit a863d65561
1 changed files with 9 additions and 1 deletions

View File

@ -7,10 +7,18 @@
#
MACRO(CHECK_TYPE_SIZE TYPE 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)
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${PROJECT_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckSizeOf.c
COMPILE_DEFINITIONS -DCHECK_SIZE_OF="${TYPE}"
COMPILE_DEFINITIONS ${MACRO_CHECK_TYPE_SIZE_FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF(NOT HAVE_${VARIABLE})
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log