diff options
author | Brad King <brad.king@kitware.com> | 2002-12-30 16:02:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-12-30 16:02:31 (GMT) |
commit | ea1467d056f4b0e646376f4dc5091dec397a46a8 (patch) | |
tree | 1f16c81824978fb66273aa1cc844f3ec68b0c45e | |
parent | 6e4712d6ed606205f9ca4bb5aa2de8ad19c480a7 (diff) | |
download | CMake-ea1467d056f4b0e646376f4dc5091dec397a46a8.zip CMake-ea1467d056f4b0e646376f4dc5091dec397a46a8.tar.gz CMake-ea1467d056f4b0e646376f4dc5091dec397a46a8.tar.bz2 |
ENH: Renamed Modules/CheckSizeOf to Modules/CheckTypeSize for consistency with the macro name that is defined by the module.
-rw-r--r-- | Modules/CMakeBackwardCompatibilityC.cmake | 2 | ||||
-rw-r--r-- | Modules/CheckSizeOf.c | 20 | ||||
-rw-r--r-- | Modules/CheckSizeOf.cmake | 38 | ||||
-rw-r--r-- | Modules/CheckTypeSize.c | 20 | ||||
-rw-r--r-- | Modules/CheckTypeSize.cmake | 34 | ||||
-rw-r--r-- | Tests/LoadCommand/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/LoadCommandOneConfig/CMakeLists.txt | 2 |
7 files changed, 61 insertions, 57 deletions
diff --git a/Modules/CMakeBackwardCompatibilityC.cmake b/Modules/CMakeBackwardCompatibilityC.cmake index 857a55d..a96f953 100644 --- a/Modules/CMakeBackwardCompatibilityC.cmake +++ b/Modules/CMakeBackwardCompatibilityC.cmake @@ -9,7 +9,7 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) - INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake) + INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT) CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG) CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) diff --git a/Modules/CheckSizeOf.c b/Modules/CheckSizeOf.c deleted file mode 100644 index 139a3ab..0000000 --- a/Modules/CheckSizeOf.c +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef CHECK_SIZE_OF - -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif /* HAVE_STDINT_H */ - -int main() -{ - return sizeof(CHECK_SIZE_OF); -} - -#else /* CHECK_SIZE_OF */ - -# error "CHECK_SIZE_OF has to specify the type" - -#endif /* CHECK_SIZE_OF */ diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake index b4a880c..3820d4c 100644 --- a/Modules/CheckSizeOf.cmake +++ b/Modules/CheckSizeOf.cmake @@ -1,34 +1,4 @@ -# -# Check if the type exists and determine size of type. if the type -# exists, the size will be stored to the variable. -# -# CHECK_TYPE_SIZE - macro which checks the size of type -# VARIABLE - variable to store size if the type exists. -# - -MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) - IF("${VARIABLE}" MATCHES "^${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) - MESSAGE(STATUS "Check size of ${TYPE}") - TRY_RUN(${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckSizeOf.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} - OUTPUT_VARIABLE OUTPUT) - IF(HAVE_${VARIABLE}) - MESSAGE(STATUS "Check size of ${TYPE} - done") - ELSE(HAVE_${VARIABLE}) - MESSAGE(STATUS "Check size of ${TYPE} - failed") - WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log - "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n" - APPEND) - ENDIF(HAVE_${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(CHECK_TYPE_SIZE) +MESSAGE(SEND_ERROR + "Modules/CheckSizeOf.cmake has been removed. " + "Use Modules/CheckTypeSize.cmake instead. This " + "compatability check may be removed before the next release!") diff --git a/Modules/CheckTypeSize.c b/Modules/CheckTypeSize.c new file mode 100644 index 0000000..43de439 --- /dev/null +++ b/Modules/CheckTypeSize.c @@ -0,0 +1,20 @@ +#ifdef CHECK_TYPE_SIZE_TYPE + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif /* HAVE_STDINT_H */ + +int main() +{ + return sizeof(CHECK_TYPE_SIZE_TYPE); +} + +#else /* CHECK_TYPE_SIZE_TYPE */ + +# error "CHECK_TYPE_SIZE_TYPE has to specify the type" + +#endif /* CHECK_TYPE_SIZE_TYPE */ diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake new file mode 100644 index 0000000..35dcaaa --- /dev/null +++ b/Modules/CheckTypeSize.cmake @@ -0,0 +1,34 @@ +# +# Check if the type exists and determine size of type. if the type +# exists, the size will be stored to the variable. +# +# CHECK_TYPE_SIZE - macro which checks the size of type +# VARIABLE - variable to store size if the type exists. +# + +MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) + IF("${VARIABLE}" MATCHES "^${VARIABLE}$") + SET(MACRO_CHECK_TYPE_SIZE_FLAGS -DCHECK_TYPE_SIZE_TYPE="${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) + MESSAGE(STATUS "Check size of ${TYPE}") + TRY_RUN(${VARIABLE} HAVE_${VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_ROOT}/Modules/CheckTypeSize.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} + OUTPUT_VARIABLE OUTPUT) + IF(HAVE_${VARIABLE}) + MESSAGE(STATUS "Check size of ${TYPE} - done") + ELSE(HAVE_${VARIABLE}) + MESSAGE(STATUS "Check size of ${TYPE} - failed") + WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log + "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n" + APPEND) + ENDIF(HAVE_${VARIABLE}) + ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") +ENDMACRO(CHECK_TYPE_SIZE) diff --git a/Tests/LoadCommand/CMakeLists.txt b/Tests/LoadCommand/CMakeLists.txt index b20b414..24f9859 100644 --- a/Tests/LoadCommand/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(LoadedCommand) # set a definition SET (TEST_COMMAND_TEST1 1) -INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) diff --git a/Tests/LoadCommandOneConfig/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeLists.txt index b20b414..24f9859 100644 --- a/Tests/LoadCommandOneConfig/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT(LoadedCommand) # set a definition SET (TEST_COMMAND_TEST1 1) -INCLUDE (${CMAKE_ROOT}/Modules/CheckSizeOf.cmake) +INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake) CHECK_TYPE_SIZE(char SIZEOF_CHAR) INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) |