[CMake] Configure Mac OS X for 32-bit

Tron Thomas tron.thomas at verizon.net
Sun May 2 17:24:07 EDT 2010


I don't think this will work.  The first approach relies on 
CMAKE_BUILD_TYPE, which  is only applicable to make based generators.  I 
build my project on Mac OS X using Xcode, which is not make based, at 
least in this context.

The second solution just reverses the problem.  By this I mean that, 
before the upgrade, CMake would configure a project that built for the 
specific architecture during debug builds and universal binaries for 
release builds.  Applying the second approach would not allow for a 
universal binary to be built for release builds.  I supposed this would 
not be a catastrophe.  There are some project that only release 
architecture specific version of their products instead of universal 
binaries.  Still, I would expect CMake to offer the flexibility of 
configuring the project in whatever manner is desired.

On 5-2-2010 10:04, Richard Wackerbarth wrote:
> You might try this approach:
> Since you want to use 32-bit on MacOSX 10.6, when in debug, set the 
> architecture only in your particular case
>
> cmake_minimum_required(VERSION 2.4)
> PROJECT(Test)
> IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>    Message("${CMAKE_SYSTEM_VERSION}")
>    STRING (REGEX MATCH "^[^.]+" __v ${CMAKE_SYSTEM_VERSION} )
>    STRING (REGEX MATCH "[0-9][0-9]$" __version "00${__v}" )
>    STRING (COMPARE GREATER ${__version} "09" 
> _host_is_snow_leopard_or_newer )
>    IF (${_host_is_snow_leopard_or_newer})
>       IF (x${CMAKE_BUILD_TYPE} STREQUAL "xDebug")
>          SET (CMAKE_OSX_ARCHITECTURES "i386")
>       ENDIF (x${CMAKE_BUILD_TYPE} STREQUAL "xDebug")
>    ENDIF (${_host_is_snow_leopard_or_newer})
> ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
>
> ADD_EXECUTABLE(HelloWorld Hello)
>
> or this approach
>
> IF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
>    SET (CMAKE_OSX_ARCHITECTURES "i386")
> ENDIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386")
>
> Richard
>



More information about the CMake mailing list