William Jockusch
William Jockusch

Reputation: 27335

Xcode -- how do I set $(SRCRoot)?

I am working with someone's library . . . they have set $(SRCRoot) to the location the library was in on their computer. On my computer, it is in a different location. This is messing everything up. How do I change it?

Upvotes: 7

Views: 18745

Answers (5)

CodeBender
CodeBender

Reputation: 36660

These answers are all on the fairly old side, so I wanted to provide something current as of Xcode 7.3.1.

I needed to change the location of the SRCROOT for my Workspace due to some external folders. This was done by moving the .xcworkspace and .xcodeproj to the new location. After that, I just had to update a few items:

  • All files inside my project
  • The search path for the Framework (Under build settings / Framework search paths)
  • The location of my info.plist file (Under build settings /, info.plist file)

Your mileage may vary based on other items you may have, but this should cover the basics.

Upvotes: 0

Konstantinos Kontos
Konstantinos Kontos

Reputation: 140

Adding a custom user setting (SRCROOT) will work only partially. If your project is under source control you may find that source files are marked red - i.e. Xcode cannot locate them.

Simply open up the project file into a text editor and replace all occurrences of the old source code folder name.

Works fine.

Upvotes: 1

xhan
xhan

Reputation: 6297

SRCRoot is one of the default variables of Xcode

The best source is probably Apple's official documentation

Upvotes: 3

mipadi
mipadi

Reputation: 411082

SRCROOT, like any Xcode build variable, is set in the Build options in the Target settings. However, setting SRCROOT is not supported through the interface options (because you shouldn't set it manually in the first place), so it'll fall under "User-Defined" settings if someone set it manually. You'll want to select it and then delete it. Here's a picture to demonstrate: alt text

Upvotes: 4

Alexsander Akers
Alexsander Akers

Reputation: 16024

You must define SRCRoot, not $(...), because the $(x) command returns the value stored in x.

Upvotes: 4

Related Questions