summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-10-05 17:11:34 (GMT)
committerBrad King <brad.king@kitware.com>2005-10-05 17:11:34 (GMT)
commit01ac3906da339451729f5ef43ef7367647537b59 (patch)
tree4f4a1fad3a8985a222aae8649b965be9588639c1 /Source/kwsys/CMakeLists.txt
parentab620983564a3ce586fbf6ea3bee8abdb43a924f (diff)
downloadCMake-01ac3906da339451729f5ef43ef7367647537b59.zip
CMake-01ac3906da339451729f5ef43ef7367647537b59.tar.gz
CMake-01ac3906da339451729f5ef43ef7367647537b59.tar.bz2
BUG: Reverting fundamental type info change until it is fixed on more platforms. It was tested on Linux, SGI, HP, Sun, OSX, Windows with nmake and VS 6, 7, 7.1, 8, Borland Make, and cygwin by hand with spaces in the path and cmake 2.0 and 2.2 before committing but still seems to be failing on some dashboards...strange.
Diffstat (limited to 'Source/kwsys/CMakeLists.txt')
-rw-r--r--Source/kwsys/CMakeLists.txt84
1 files changed, 34 insertions, 50 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index d6bc472..77c7030 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -254,56 +254,20 @@ IF(UNIX)
ENDIF(UNIX)
IF(KWSYS_USE_FundamentalType)
- # Load fundamental type information generated by the below try-run.
- IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- # The file already exists. Load it now.
- INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- ELSE(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- # The file does not exist. Try to generate it. All the type
- # information can be detected by a single try-run because the
- # available types can be determined at compile time. This
- # significantly reduces the number of try-compiles and try-runs needed
- # to collect this information.
- MESSAGE(STATUS "Checking C++ fundamental types")
-
- # Pass the output directory in KWSYS_CXX_TYPE_INFO_DIR as a cache
- # entry to work-around some CMake parsing problems when there are
- # spaces in the path (for CMake 2.2.1 and lower). Do not quote
- # the definition for VS 7 or 8 to work-around a CMake 2.2.1 and
- # lower generator bug.
- SET(DOLLAR "$")
- IF(CMAKE_GENERATOR MATCHES "Visual Studio [78]")
- SET(QUOTE "")
- ELSE(CMAKE_GENERATOR MATCHES "Visual Studio [78]")
- SET(QUOTE "\"")
- ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio [78]")
- TRY_RUN(KWSYS_CXX_TYPE_INFO KWSYS_CXX_TYPE_INFO_COMPILED
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx
- CMAKE_FLAGS
- "-DKWSYS_CXX_TYPE_INFO_DIR:STRING=${CMAKE_CURRENT_BINARY_DIR}"
- COMPILE_DEFINITIONS
- -DTEST_KWSYS_CXX_TYPE_INFO
- "-DKWSYS_CXX_TYPE_INFO_FILE=${QUOTE}${DOLLAR}{KWSYS_CXX_TYPE_INFO_DIR}/FundamentalTypeInfo.cmake${QUOTE}"
- OUTPUT_VARIABLE OUTPUT
- )
-
- # Check if the file now exists.
- IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- # The file exists. Report success and load it.
- MESSAGE(STATUS "Checking C++ fundamental types -- success")
- FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeOutput.log
- "Checking C++ fundamental types compiled with the following output:\n${OUTPUT}\n\n")
- INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- ELSE(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- # The file does not exist. Report failure.
- MESSAGE(STATUS "Checking C++ fundamental types -- failure")
- FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Checking C++ fundamental types failed to compile with the following output:\n${OUTPUT}\n\n")
- MESSAGE(FATAL_ERROR "Checking C++ fundamental type information failed. "
- "Check \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeError.log\" for more information.")
- ENDIF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
- ENDIF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FundamentalTypeInfo.cmake)
+ # Determine type sizes.
+ INCLUDE(CheckTypeSize)
+ CHECK_TYPE_SIZE("char" KWSYS_SIZEOF_CHAR)
+ CHECK_TYPE_SIZE("short" KWSYS_SIZEOF_SHORT)
+ CHECK_TYPE_SIZE("int" KWSYS_SIZEOF_INT)
+ CHECK_TYPE_SIZE("long" KWSYS_SIZEOF_LONG)
+ CHECK_TYPE_SIZE("long long" KWSYS_SIZEOF_LONG_LONG)
+ CHECK_TYPE_SIZE("__int64" KWSYS_SIZEOF___INT64)
+ IF(NOT KWSYS_SIZEOF_LONG_LONG)
+ SET(KWSYS_SIZEOF_LONG_LONG 0)
+ ENDIF(NOT KWSYS_SIZEOF_LONG_LONG)
+ IF(NOT KWSYS_SIZEOF___INT64)
+ SET(KWSYS_SIZEOF___INT64 0)
+ ENDIF(NOT KWSYS_SIZEOF___INT64)
# Check uniqueness of types.
IF(KWSYS_SIZEOF___INT64)
@@ -339,6 +303,26 @@ IF(KWSYS_USE_FundamentalType)
ELSE(KWSYS_USE___INT64)
SET(KWSYS_CAN_CONVERT_UI64_TO_DOUBLE 1)
ENDIF(KWSYS_USE___INT64)
+
+ # Check signedness of "char" type.
+ IF("KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$")
+ MESSAGE(STATUS "Checking signedness of char")
+ TRY_RUN(KWSYS_CHAR_IS_SIGNED KWSYS_CHAR_IS_SIGNED_COMPILED
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx
+ COMPILE_DEFINITIONS -DTEST_KWSYS_CHAR_IS_SIGNED)
+ IF(KWSYS_CHAR_IS_SIGNED_COMPILED)
+ IF(KWSYS_CHAR_IS_SIGNED)
+ MESSAGE(STATUS "Checking signedness of char -- signed")
+ SET(KWSYS_CHAR_IS_SIGNED 1 CACHE INTERNAL "Whether char is signed.")
+ ELSE(KWSYS_CHAR_IS_SIGNED)
+ MESSAGE(STATUS "Checking signedness of char -- unsigned")
+ SET(KWSYS_CHAR_IS_SIGNED 0 CACHE INTERNAL "Whether char is signed.")
+ ENDIF(KWSYS_CHAR_IS_SIGNED)
+ ELSE(KWSYS_CHAR_IS_SIGNED_COMPILED)
+ MESSAGE(FATAL_ERROR "Checking signedness of char -- failed")
+ ENDIF(KWSYS_CHAR_IS_SIGNED_COMPILED)
+ ENDIF("KWSYS_CHAR_IS_SIGNED" MATCHES "^KWSYS_CHAR_IS_SIGNED$")
ENDIF(KWSYS_USE_FundamentalType)
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")