[CMake] MACOSX_DEPLOYMENT_TARGET

Brad King brad.king at kitware.com
Wed Oct 11 09:28:20 EDT 2006


Axel Roebel wrote:
> The problem is that to my knowledge the only way to communicate the 
> deployment target to gcc is via environment variables. I admit this is a 
> really strange way (probably its save to say silly) to select compiler 
> options, but as far as I know, this is the way it is done in Xcode. And it is 
> the way it is suggested by apple for makefiles
> 
> see (at the very bottom )
> http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/Using/chapter_3_section_2.html#//apple_ref/doc/uid/20002000-1114311-BABGCAAB
> 
> This means in the makefile the compiler needs to be called
> as in
> 
> target :
> 	MACOSX_DEPLOYMENT_TARGET=10.3 gcc ...
> 
> so the question would be how to achieve this.
> I've the strong feeling it is not possible - is it?

Try creating a shell script called "gcc-osx-10.3" containing something like

#!/bin/sh
export MACOSX_DEPLOYMENT_TARGET=10.3
exec gcc "$@"

and then set that as your compiler.

-Brad


More information about the CMake mailing list