Xcode – How to compile for Mac OS X 10.5

gccmacosxcode

I'd like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I've tried -isysroot /Developer/SDKs/MacOSX10.5.sdk but that doesn't seem to work. Is there a GCC flag that allows me to set the SDK?

(Incidentally, I changed the gcc symbolic link to point to gcc-4.0 instead of gcc-4.2 and it worked but I thought I could tell the latest GCC to compile for an older SDK).

Thanks,
Rui

Best Answer

In XCode you only need to set the deployment target to OSX 10.5.
For gcc you need to set -mmacosx-version-min=10.5.