Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify where XCode stores the compiled binaries?

I'm writing in C++11 and for some reason, I haven't been able to get gcc to compile it, so I've been using XCode. However, I'm writing programs that take arguments from the command line, so I need to be able to run them from the shell. Right now, XCode is burying the binaries it compiles in a deep and inconvenient location (/Users/username/Library/Developer/XCode/DerivedData/ProjectName/Build/Products/Debug/... yikes!). I'd like to be able to specify a better location for them, and possibly another name as well. I'm using XCode 4.5.2. Can anyone help me out with this?

like image 493
limp_chimp Avatar asked Jan 20 '13 20:01

limp_chimp


People also ask

Where are Xcode files stored?

Most caches are stored in ~/Library/Caches, including the Xcode cache. You'll find Xcode's cache at ~/Library/Caches/com. apple.

Where are Xcode builds located?

It should by located in: ~/Library/Developer/Xcode/DerivedData . Save this answer. Show activity on this post. You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.

What is binary Xcode?

An app binary is a file that contains machine code for a computer to execute.


1 Answers

You can configure this once globally for all projects in the Xcode preferences:

"Xcode" Menu -> "Preferences..." -> "Locations" Tab -> "Advanced..." Button

Or you can change it per project. Just open a project, select one of the project windows and then:

"File" Menu -> "Project Settings..." -> "Advanced..."

Unless otherwise configured, new projects use the defaults you have configured in the global Xcode prefs, but you may want to override them for individual projects.

Note that if you select "Legacy", Xcode will place them by default into the folder where the Xcode project itself is located, but "Legacy" also allows you to specify the location using build settings, thus you can even set different locations per target. The project settings are named Build Products Path and Intermediate Build Files Path. If you are not in "Legacy" mode (either by setting it on the project or globally for all projects), these two build settings have no effect and are entirely ignored.

Also note that when you build Xcode projects on command line using xcodebuild, they are always built in legacy mode, regardless what you configured in Xcode or in the project settings. This is useful, since it allows you to override the output location from command line by overriding the two projects settings I mentioned above. This can be either done in a xcconfig file, just tell xcodebuild to read config from such a file (-xcconfig <filename>) or it can be done directly on the command line by adding <setting>=<value> as an argument at the end of the xcodebuild call. When specified in a xcconfig file or via command line, the two settings are named SYMROOT (=Build Products Path) and OBJROOT (=Intermediate Build Files Path).

like image 138
Mecki Avatar answered Sep 29 '22 08:09

Mecki