Is it possible to get the workspace path in Xcode 4 through an environment variable

I cannot find anything workspace related to Xcode build customization help .

Essentially I need something like $ (WORKSPACE_DIR). If Xcode does not provide it, is there a way to define a user variable that can somehow accurately indicate the path of the workspace if the workspace moves (think of branches, etc.)?

+8
xcode xcode4
source share
2 answers

Custom variables can be defined in the build settings. I think there is a button called Add Build Setting. Thus, the new root of the workspace variable can be defined relative to SRCROOT or use an absolute path.

The new parameter is displayed in the User Defined group in the assembly settings. The "Add build setup" button is located in the lower right corner.

+3
source share

If your workspace is configured like this:

//bla/bla/bla/workspace/{project directories}* 

then you can use

 $(SRCROOT)/../ 

to get the workspace directory from the project project directory.


For example, if you want to have one project link title in another project:

Project Build Settings-> User Header Search Paths => $ (SRCROOT) /../ SomeLibProj

(and set it to "recursive" if you do not want to add each folder)

+3
source share

All Articles