从编译中禁用XCode项目中的某些文件 [英] Disabling some files in XCode project from compilation
问题描述
我已经通过复制现有文件夹在XCode中启动了一个新项目,因为我的新应用程序将与旧版本具有许多共同功能。
I have started a new project in XCode by duplicating an existing folder, because my new app will have a lot of common features with the old one.
问题是新的应用程序将不会使用我在旧应用程序中使用的框架。当我删除框架时,包括该框架在内的所有文件都会引发错误。
The problem is that the new app won't be using a framework I used in the old app. When I deleted the framework, of course all files including that framework raised errors.
基本上我想在许多文件上禁用所有语法检查,依赖性检查等。我希望XCode忽略这些文件,尽管它们在项目树中。稍后当我修改它们时,我将再次手动启用它们。通过这种方式,我可以编译和测试我的小错误更改,而不会修复它在未修改文件中导致的所有错误,无论如何我将在未来修复。
Basically I want to disable all syntax checks, dependancy checks, etc. on many files. I want XCode to ignore these files, although they are in the project tree. Later when I revise them I will manually enable them again. This way I can compile and test my small changes for errors without fixing all errors it causes in the "not revised" files, which I will be fixing in the future anyway.
我可以从项目树中删除它们,然后在我的工作完成后逐个添加它们,但我不想这样做,因为我的项目树可能搞砸了,应该有另一种方法来实现这一点。
I could delete them from the project tree and then add them again one by one when my job's done, but I don't want to do this because my project tree might get messed up and there should really be another way to accomplish this.
我尝试从所有目标会员资格中删除这些文件,但没有帮助。
I tried removing those files from all target memberships, but it didn't help.
提前致谢。
推荐答案
如果需要删除大量文件,可以创建用户定义的构建设置,该设置应该被称为EXCLUDED_SOURCE_FILE_NAMES。并添加文件名或模式。
If you need to remove a lot of files, you could create User-Defined Build Setting which should be called EXCLUDED_SOURCE_FILE_NAMES. And add file names or patterns.
在我的情况下,我选择了我想省略一些文件的目标,编辑器 - >添加构建设置 - >添加用户自定义设置(起初,这是灰色的。我选择了项目文件(就在TARGETS之上),然后重新选择了目标文件,并且能够创建用户定义的设置) - >将其命名为EXCLUDED_SOURCE_FILE_NAMES - >值类似于PREFIX *
In my case I selected the target I wanted to omit some files, Editor -> Add Build Setting -> Add User-Defined Setting (at first this is greyed out somehow. I selected the project file (just above TARGETS) then reselected target file and was able to create User-Defined Setting) -> name it EXCLUDED_SOURCE_FILE_NAMES -> value something like PREFIX*
当然,您可以为所有目标创建整个项目的用户定义设置。
Of course you can create User-Defined Setting for whole project that way all targets will have it.
示例如何:
Example how it may look:
原创回答: http://lists.apple.com/archives/xcode -users / 2009 / Jun / msg00153.html
这篇关于从编译中禁用XCode项目中的某些文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!