开发者

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

I am working with 开发者_C百科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?


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


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:

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


SRCRoot is one of the default variables of Xcode

The best source is probably Apple's official documentation


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜