On Thursday 11 June 2009, Sean McBride wrote: > On 6/11/09 3:00 PM, Michael Jackson said: > >-- CMAKE_SIZEOF_VOID_P: 4 <============ THIS IS WRONG FOR X64 builds > > Yeah, but gcc on 10.5 and earlier defaults to building 32 bit. If you > want 64 bit you need to pass '-arch x86_64' (or ppc64). Or in the case > of CMake, use CMAKE_OSX_ARCHITECTURES (or whatever its called). > > But if you use multiple architectures, like i386 _and_ x86_64, then each > arch can and does have a different size void*. Now sure what CMake does > there, hopefully warns or errors. > > Always best to avoid TRY_RUNs and I guess TRY_COMPILES too for Universal > Binaries/cross compilation.
This is from CheckTypeSize.cmake: SET(CMAKE_CHECKTYPESIZE_FIRST_RESULT "FIRST_LOOP") FOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) IF("${info}" MATCHES ".*INFO:sizeof\\[0*([^]]*)\\].*") STRING(REGEX REPLACE ".*INFO:sizeof\\[0*([^]]*)\\].*" "\\1" ${VARIABLE} "${info}") ENDIF("${info}" MATCHES ".*INFO:sizeof\\[0*([^]]*)\\].*") IF("${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "FIRST_LOOP") SET(CMAKE_CHECKTYPESIZE_FIRST_RESULT "${${VARIABLE}}") ENDIF("${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "FIRST_LOOP") IF(NOT "${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "${${VARIABLE}}") MESSAGE(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") ENDIF(NOT "${CMAKE_CHECKTYPESIZE_FIRST_RESULT}" STREQUAL "${${VARIABLE}}") ENDFOREACH(info ${CMAKE_CHECKTYPESIZE_STRINGS}) So if you are building universal binaries, and if check_type_size() finds more than one result, and if these results differ, then there should be an error generated. I can't test that here, I don't have a Mac at hand. Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake