Use one arch for 1.4-compatible check_type_size

The CMakeBackwardCompatibilityC module provides some try-compile results
that were automatically provided by CMake 1.4.  When performing the
checks for OS X universal binaries we just pick one architecture to get
through the checks without error.  Since CMake 1.4 did not support any
universal binaries, projects that want them should not depend on this
compatibility module anyway.
This commit is contained in:
Brad King 2009-12-01 17:35:39 -05:00
parent bbfcb198f8
commit 27873a48d7
1 changed files with 16 additions and 0 deletions

View File

@ -23,6 +23,17 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
# Old CMake versions did not support OS X universal binaries anyway,
# so just get through this with at least some size for the types.
LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS)
IF(${NUM_ARCHS} GREATER 1)
IF(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
MESSAGE(WARNING "This module does not work with OS X universal binaries.")
SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1)
LIST(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
ENDIF()
ENDIF()
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
@ -70,6 +81,11 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
"Use sproc libs.")
IF(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
SET(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
ENDIF()
ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
MARK_AS_ADVANCED(