summaryrefslogtreecommitdiffstats
path: root/Modules/CheckSizeOf.cmake
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-24 20:20:08 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-09-24 20:20:08 (GMT)
commita863d65561152b8a1696b4b6a387805097d8de13 (patch)
tree1a0a14608df282b1eed0ddc4fdeca31c4af85939 /Modules/CheckSizeOf.cmake
parent94ff97ceed358ca8bf71d1c9a647f6cc10f90142 (diff)
downloadCMake-a863d65561152b8a1696b4b6a387805097d8de13.zip
CMake-a863d65561152b8a1696b4b6a387805097d8de13.tar.gz
CMake-a863d65561152b8a1696b4b6a387805097d8de13.tar.bz2
Improve check size of. Now it checks for some header files before trying to check types
Diffstat (limited to 'Modules/CheckSizeOf.cmake')
-rw-r--r--Modules/CheckSizeOf.cmake10
1 files changed, 9 insertions, 1 deletions
diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake
index 34f8d50..dcf0991 100644
--- a/Modules/CheckSizeOf.cmake
+++ b/Modules/CheckSizeOf.cmake
@@ -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