ENH: Add option of adding random include files before doing CheckTypeSize
This commit is contained in:
parent
b1a1526e14
commit
518de19f74
|
@ -1,5 +1,7 @@
|
||||||
#ifdef CHECK_TYPE_SIZE_TYPE
|
#ifdef CHECK_TYPE_SIZE_TYPE
|
||||||
|
|
||||||
|
@CHECK_TYPE_SIZE_PREINCLUDE@
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif /* HAVE_SYS_TYPES_H */
|
#endif /* HAVE_SYS_TYPES_H */
|
||||||
|
@ -12,6 +14,8 @@
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
#endif /* HAVE_STDDEF_H */
|
#endif /* HAVE_STDDEF_H */
|
||||||
|
|
||||||
|
@CHECK_TYPE_SIZE_PREMAIN@
|
||||||
|
|
||||||
#ifdef __CLASSIC_C__
|
#ifdef __CLASSIC_C__
|
||||||
int main(){
|
int main(){
|
||||||
int ac;
|
int ac;
|
|
@ -18,6 +18,14 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
|
||||||
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
||||||
ENDIF("${def}")
|
ENDIF("${def}")
|
||||||
ENDFOREACH(def)
|
ENDFOREACH(def)
|
||||||
|
SET(CHECK_TYPE_SIZE_PREMAIN)
|
||||||
|
FOREACH(def ${CMAKE_EXTRA_INCLUDE_FILES})
|
||||||
|
SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n")
|
||||||
|
ENDFOREACH(def)
|
||||||
|
CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CheckTypeSize.c.in"
|
||||||
|
"${CMAKE_BINARY_DIR}/CMakeTmp/CheckTypeSize.c" IMMEDIATE @ONLY)
|
||||||
|
FILE(READ "${CMAKE_BINARY_DIR}/CMakeTmp/CheckTypeSize.c"
|
||||||
|
CHECK_TYPE_SIZE_FILE_CONTENT)
|
||||||
MESSAGE(STATUS "Check size of ${TYPE}")
|
MESSAGE(STATUS "Check size of ${TYPE}")
|
||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CHECK_TYPE_SIZE_ADD_LIBRARIES
|
SET(CHECK_TYPE_SIZE_ADD_LIBRARIES
|
||||||
|
@ -25,7 +33,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
||||||
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
|
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_ROOT}/Modules/CheckTypeSize.c
|
"${CMAKE_BINARY_DIR}/CMakeTmp/CheckTypeSize.c"
|
||||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
|
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
|
||||||
"${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
|
"${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
|
@ -36,7 +44,7 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
|
||||||
ELSE(HAVE_${VARIABLE})
|
ELSE(HAVE_${VARIABLE})
|
||||||
MESSAGE(STATUS "Check size of ${TYPE} - failed")
|
MESSAGE(STATUS "Check size of ${TYPE} - failed")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
|
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
|
||||||
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n")
|
"Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n")
|
||||||
ENDIF(HAVE_${VARIABLE})
|
ENDIF(HAVE_${VARIABLE})
|
||||||
ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
||||||
SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS )
|
SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS )
|
||||||
|
|
Loading…
Reference in New Issue