Xcode 构建设置“构建产品路径”(CONFIGURATION_BUILD_DIR)是谎言?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29731884/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode build setting "Build Products Path" (CONFIGURATION_BUILD_DIR) is a lie?
提问by Rob N
If I create a new application project, the build settings look something like this:
如果我创建一个新的应用程序项目,构建设置看起来像这样:
It claims to be using a build dir build/Debug-iphoneos
. I assume this is relative to the project directory? In reality, the project is compiled to the "derived data" directory, under ~/Library/Developer/Xcode/DerivedData/CryptoTest2-abc...
它声称正在使用构建目录build/Debug-iphoneos
。我假设这是相对于项目目录?实际上,项目被编译到“派生数据”目录下,~/Library/Developer/Xcode/DerivedData/CryptoTest2-abc...
So what is going on here? Is this build setting simply ignored? What is the build setting that controls the output directory?
那么这里发生了什么?这个构建设置是否被简单地忽略了?控制输出目录的构建设置是什么?
回答by Stéphane Copin
This build setting is actually relative to the Derived Data setting.
You can change this setting if you go to Xcode > Preferences > Locations, and change the Derived Data directory setting to whatever suits your needs (Default, Relative or Custom).
此构建设置实际上与派生数据设置相关。如果您转到 Xcode > Preferences > Locations,并将派生数据目录设置更改为适合您需要的任何设置(默认、相对或自定义),您可以更改此设置。
You can also specify this on a per project-basis, if you specify an absolute path for that settings:
如果您为该设置指定绝对路径,您还可以在每个项目的基础上指定它:
- You can either hardcode a path such as
/build/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}
, then the project will be built into the folder build in the root folder. - Or can you can choose to prepend the existing path with another environment variable. For example, to make the path relative to your project/workspace (As you would expect), you can prepend the original value with
${SRCROOT}/
, effectively creating abuild
folder at the root of your project/workspace.
- 您可以对路径进行硬编码,例如
/build/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}
,然后项目将被构建到根文件夹中的文件夹 build 中。 - 或者您可以选择在现有路径前面加上另一个环境变量。例如,要使路径相对于您的项目/工作区(如您所料),您可以在原始值前面加上
${SRCROOT}/
,有效地build
在项目/工作区的根目录下创建一个文件夹。
Settings that can be substitued in ${<setting>}
are called Build settings, and are set automatically by Xcode/xcodebuild whenever you start building your project. Apple maintains a list of the available build settings here:
http://help.apple.com/xcode/mac/8.0/#/itcaec37c2a6
可以替换的设置${<setting>}
称为Build settings,并且在您开始构建项目时由 Xcode/xcodebuild 自动设置。Apple 在此处维护可用构建设置的列表:http:
//help.apple.com/xcode/mac/8.0/#/itcaec37c2a6
回答by Krzysiek
Go to File-> Workspace Settings-> Advancedand select Legacy
转到文件->工作区设置->高级并选择旧版