ENH: make sure all required headers are checked before checking type size

This commit is contained in:
Bill Hoffman 2008-04-25 09:09:06 -04:00
parent 6482d38bdf
commit 5f68965608
1 changed files with 13 additions and 1 deletions

View File

@ -1,7 +1,11 @@
# - Check sizeof a type # - Check sizeof a type
# CHECK_TYPE_SIZE(TYPE VARIABLE) # CHECK_TYPE_SIZE(TYPE VARIABLE)
# Check if the type exists and determine size of type. if the type # Check if the type exists and determine size of type. if the type
# exists, the size will be stored to the variable. # exists, the size will be stored to the variable. This also
# calls check_include_file for sys/types.h stdint.h
# and stddef.h, setting HAVE_SYS_TYPES_H, HAVE_STDINT_H,
# and HAVE_STDDEF_H. This is because many types are stored
# in these include files.
# VARIABLE - variable to store size if the type exists. # VARIABLE - variable to store size if the type exists.
# HAVE_${VARIABLE} - does the variable exists or not # HAVE_${VARIABLE} - does the variable exists or not
# The following variables may be set before calling this macro to # The following variables may be set before calling this macro to
@ -12,6 +16,14 @@
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# These variables are referenced in CheckTypeSizeC.c so we have
# to check for them.
include(CheckIncludeFile)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
MESSAGE(STATUS "Check size of ${TYPE}") MESSAGE(STATUS "Check size of ${TYPE}")