Xcode Target (Apple Document) Xcode中的Target含义

首先附上原文地址:

http://developer.apple.com/library/mac/#featuredarticles/XcodeConcepts/Concept-Targets.html#//apple_ref/doc/uid/TP40009328-CH4-SW1

然后,粘贴原文,怕以后苹果改了文档连接...


第一版,以后还要逐步修改,更加贴切

Xcode Target

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.

The instructions for building a product take the form of build settings and build phases, which you can examine and edit in the Xcode project editor. A target inherits the project build settings, but you can override any of the project settings by specifying different settings at the target level. There can be only one active target at a time; the Xcode scheme specifies the active target.

A target and the product it creates can be related to another target. If a target requires the output of another target in order to build, the first target is said to depend upon the second. If both targets are in the same workspace, Xcode can discover the dependency, in which case it builds the products in the required order. Such a relationship is referred to as an implicit dependency. You can also specify explicit target dependencies in your build settings, and you can specify that two targets that Xcode might expect to have an implicit dependency are actually not dependent. For example, you might build both a library and an application that links against that library in the same workspace. Xcode can discover this relationship and automatically build the library first. However, if you actually want to link against a version of the library other than the one built in the workspace, you can create an explicit dependency in your build settings, which overrides this implicit dependency.



翻译一下,为了自己能更懂。

Xcode Target
Target指定一个编译的 产品
Target中包含一些指令,这些指令是关于如何调用在一个工程或者工作区的文件集合来编译这个 产品的。一个Target定一个单独的产品;它管理组织在这个编译系统中,需要用来编译这个产品的输入(输入既是源文件和处理这些源文件的指令)。
用来编译这个产品的指令,是以'编译设置' (build settings)和'编译阶段' (build phases)这两个形式存在,你在Xcode的工程编辑器中可以查看和编辑这两项。
(ps:也就是你通过修改这两个内容来达到编辑工程指令的目的,你就是用这种方式来修改和输入编译指令的)
Target 沿袭工程编译设置内容,但是你可以在Targe层通过指定不同的属性设置来重写任何工程设置。同一时间只能存在一个活动的Target;
Xcode Scheme 指定活动的Target。


Target 以及它所制定的产品可以与另一个Target相关联,如果一个Target需要依赖另一个Target的输出才能编译的话,前者既是依赖于后者的。如果两个Target都是在同一个工作区,Xcode可以发现这个依赖关系,进而以一个正确的顺序编译它们。这种关系被定义为:隐含依赖。你也可以在你的编译设置 (build settings)中指定明显的Target依赖,你可以指定在Xcode可能会期望两个target中存在隐含依赖的关系为非依赖关系。例如,你可能编译一个库文件和一个程序文件,程序文件内部链接了这个库文件,那么Xcode会发现这个这个关系并且自动先编译库文件。然而,如果你事实上想要链接的不是此版本的库文件 ,也就是不想链接这个库文件新编译出来的,你可以在你的编译设置(build settings)里创建一个明显的依赖关系,来覆盖这个隐含依赖。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值