[CMake] MACOSX_DEPLOYMENT_TARGET

Axel Roebel Axel.Roebel at ircam.fr
Tue Oct 10 15:47:28 EDT 2006


Hi,

in my cmake projects I support mac os x and
I am creating universal binaries by means of
compilation on different (ppc and intel) machines
and later combining the results using lipo.

For maximum backwards compatibility I need to
set the environment variable

 MACOSX_DEPLOYMENT_TARGET=10.3

on the ppc system and to

 MACOSX_DEPLOYMENT_TARGET=10.4

for the intel. In the mac docs I found the following way that the deployment 
target should be selected for individual compiler calls

$>  MACOSX_DEPLOYMENT_TARGET=10.4 gcc  ... compiler args

Up to now I did not find any means to change the compilation environment
during build time using cmake. I am using unix makefiles here
so the compiler call should in fact be preceded by the online 
environment declaration as above.

What I do now is to replace the compiler by a shell script 
that I create during configuration  and that contains
(for ppc)

#! /bin/bash
MACOSX_DEPLOYMENT_TARGET=10.3 /usr/bin/gcc "$@"

At the same time I patch the 
CMakeCCompiler.cmake file to use this shell script instead 
of the orginal compiler.

While this solution works ok, I don't like it at all and I wonder
whether there is a solution that requires less hacking
of the cmake internals.

Kind regards,

-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list