Re: Building For OS 10.1, 10.2, and 10.3
Re: Building For OS 10.1, 10.2, and 10.3
- Subject: Re: Building For OS 10.1, 10.2, and 10.3
- From: Chris Espinosa <email@hidden>
- Date: Mon, 5 Jan 2004 16:04:21 -0800
On Jan 5, 2004, at 3:44 PM, Glen Low wrote:
If you want to build something on the current OS but make sure it
runs on older OS versions, you only need to set the Mac OS X
Deployment Target setting. This ensures that any APIs that you use
that are newer than that target are "weak-linked", that is, do not
cause load-time failures but are instead set to null. You need to
check for null before calling any API that was introduced after your
target (this includes later versions of that target: if you set your
target to 10.2, you may need to check for APIs introduced in
10.2.110.2.8 as well as those introduced in 10.3.x)
You do not need to change the SDK setting from "Current" if all you
want to do is to run on older versions.
If you don't want to do the runtime checks for APIs, and you're not
using new Panther features, you can set the SDK to an older version
(10.2.8, for example). If you use 10.3.x constructs, you'll get a
compiler error or warning. Your code will run on 10.2 through
10.3.x.
What then is the implication of having External Frameworks and
Libraries pointing to frameworks in the main system and not to the
SDK? Does setting the cross-develop target (project info) and/or
deployment target (target build info) cause these to automagically
refer to their counterparts in the SDK?
Setting the SDK sets the build variable $(SDKROOT), and the build
system automatically prefaces all system paths (e.g. /usr, /System,
etc.) with the SDKROOT path. Paths to non-System external frameworks
and libraries (e.g. your own) aren't affected. So, yes, setting the
cross-development target automagically redirects these.
The deployment target has no effect on paths. It simply triggers the
weak-linking features of AvailabilityMacros.h.
As I've said before, you can do these independently or together:
Neither SDK nor Development Target: build for current OS only (of
course, most code will run on future OS versions too)
Just SDK and not Target: forward-develop for future OS
Just target, no SDK: build for current OS but weak-link if running on
older OS
Both SDK and target: build for older OS without using newer OS
features. (This is useful, e.g. in building KEXTs for 10.1, say)
Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.