From 5f689656087b682afede0ef9a377b5bbe2abf4ea Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 25 Apr 2008 09:09:06 -0400 Subject: ENH: make sure all required headers are checked before checking type size --- Modules/CheckTypeSize.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Modules/CheckTypeSize.cmake') diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 0e7e364a8d..37ea75d7dc 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -1,7 +1,11 @@ # - Check sizeof a type # CHECK_TYPE_SIZE(TYPE VARIABLE) # 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. # HAVE_${VARIABLE} - does the variable exists or not # The following variables may be set before calling this macro to @@ -12,6 +16,14 @@ # CMAKE_REQUIRED_INCLUDES = list of include directories # 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) IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") MESSAGE(STATUS "Check size of ${TYPE}") -- cgit v1.2.1