[CMake] CMAKE_OSX_ARCHITECTURES and 4-way universal binaries
Michael Jackson
mike.jackson at bluequartz.net
Mon Dec 8 21:05:28 EST 2008
On Dec 8, 2008, at 8:28 PM, Sean McBride wrote:
> Hi all,
>
> With 2.6.2, when I do 'C'onfigure, CMake gives me:
>
> CMake Error at /Applications/CMake 2.6-2.app/Contents/share/cmake-2.6/
> Modules/CheckTypeSize.cmake:89 (MESSAGE):
> CHECK_TYPE_SIZE found different results, consider setting
> CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to
> one or no
> architecture !
> Call Stack (most recent call first):
> Utilities/kwsys/CMakeLists.txt:456 (CHECK_TYPE_SIZE)
>
> If I ignore it, things seem to be OK, but this has been bugging me
> for a
> while now.
>
> After conferring with Mike Jackson, it turns out that if I change
> what I had:
>
> SET (CMAKE_OSX_ARCHITECTURES "ppc;ppc64;i386;x86_64" CACHE STRING
> "Rogue")
>
> to
>
> SET (CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64;ppc64;" CACHE STRING
> "Rogue")
>
> the error goes away. It surprises me that the order should be
> important.
>
> I know what CMAKE_OSX_ARCHITECTURES is, but what is
> CMAKE_TRY_COMPILE_OSX_ARCHITECTURES?
>
> What's going on?
>
> Thanks,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng sean at rogue-research.com
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
Just to add some more background I traced the error down to the
Modules/CheckTypeSize.cmake file. At line 77 in that file there is a
check for a certain string within the binary file that gets compiled.
FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/
CheckTypeSize.bin"
CMAKE_CHECKTYPESIZE_STRINGS LIMIT_COUNT 2 REGEX "INFO:sizeof")
I did a quick test on some of my own cmake code where I also do a
bunch of checks. One of those checks is the sizeof(ssize_t). When that
test is executed I get the following for the
CMAKE_CHECKTYPESIZE_STRINGS variable:
INFO:sizeof[00004]; INFO:sizeof[00008]
when I invoke cmake with the following:
DCMAKE_OSX_ARCHITECTURES:string='ppc;ppc64;i386;x86_64'
If I switch it around like Sean now has it I get:
-- Check size of size_t
-- CMAKE_CHECKTYPESIZE_STRINGS: INFO:sizeof[00004];INFO:sizeof[00004]
Which all kinda makes sense once I understood what the
FILE(STRINGS .. ) command was using for variables. But what is the
point of the code? I am not sure what sense it makes to run a
CheckTypeSize(ssize_t) on a binary that has 2 different address
models. I tried to work through some code to figure out the
ramifications but it is kinda late..
_________________________________________________________
Mike Jackson mike.jackson at bluequartz.net
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
More information about the CMake
mailing list