summaryrefslogtreecommitdiff
path: root/Modules/CheckTypeSize.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-04-25 09:09:06 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2008-04-25 09:09:06 -0400
commit5f689656087b682afede0ef9a377b5bbe2abf4ea (patch)
tree289d59712fe69844aca569d70d9e521c5783d5d0 /Modules/CheckTypeSize.cmake
parent6482d38bdf53ff5f3d12bb596b6dee4d08618b45 (diff)
downloadcmake-5f689656087b682afede0ef9a377b5bbe2abf4ea.tar.gz
ENH: make sure all required headers are checked before checking type size
Diffstat (limited to 'Modules/CheckTypeSize.cmake')
-rw-r--r--Modules/CheckTypeSize.cmake14
1 files changed, 13 insertions, 1 deletions
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}")