Xcode build setting “Build Products Path” (CONFIGURATION_BUILD_DIR) is a lie?

吃可爱长大的小学妹 提交于 2019-12-09 12:11:53

问题


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...

So what is going on here? Is this build setting simply ignored? What is the build setting that controls the output directory?


回答1:


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).

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 a build folder at the root of your project/workspace.

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




回答2:


Go to File -> Workspace Settings -> Advanced and select Legacy



来源:https://stackoverflow.com/questions/29731884/xcode-build-setting-build-products-path-configuration-build-dir-is-a-lie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!