Thursday, October 15, 2009

Section 20.1.  Xcode Build Variables










20.1. Xcode Build Variables


The action for the default make rule for .c files parameterizes almost the entire action. The command for the C compiler and the set of flags to pass are left to the makefile variables CC, CPPFLAGS, and CFLAGS. You set these flags at the head of the file to suitable values, and all the compilations in your build comply.


Xcode relies similarly on variables to organize build options but at a much finer granularity. There is one variable for each of the most common settings. For instance, the variable GCC_ENABLE_CPP_RTTI controls whether gcc's -fno-rtti will be added to suppress generation of runtime type information. This variable is set by a checkbox in the Build tab of the Get Info window for the target.


In the Groups & Files list of any Xcode project, find the Targets group, and click the disclosure triangle next to it to open the group and reveal the contents. Double-click one of the targets inside. This should reveal the Get Info window for the target, as shown in Figure 20.2. Click the Build tab if it isn't already selected.



Figure 20.2. Finding a specific gcc option in a target's settings. Open the Targets group in the Groups & Files list, and double-click a target to open the Info window. The Build tab lists most of the settings for which Xcode maintains build variables.







The list you see is a front end for most of the build variables Xcode maintains for this target. Click an item; the text area at the bottom of the Info window fills with text describing what that item does. In brackets, and usually at the end of the description, are the name of the build variable the item controls and what gcc option, if any, it affects. Both the label and the description are searchable: The list in Figure 20.2 was narrowed down to four entries by typing runtime into the search field at the top of the window.












No comments:

Post a Comment