summaryrefslogtreecommitdiffstats
path: root/Modules/CheckSizeOf.cmake
diff options
context:
space:
mode:
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