Environment variables

In Info.plist of my Xcode project, I see for instance "Executable file" is set to "$(EXECUTABLE_NAME)". I believe that "$(EXECUTABLE_NAME)" is called an environment variable. What I'd like to know is where is that environment variable set. I'd like to see where all the environment variables are set so I can use those values.

Answered by KMT in 347990022

Pls. see my reply in Why is the Cocoa Touch Framework target Build setting set to $(CURRENT_PROJECT_VERSION)?


>where is that environment variable set.


IIRC, when viewing the Info tab, if you right-click and select Show Raw Keys/Values, you'll see the actuals used by those macros are

CFBundleShortVersionString
(Version) and
CFBundleVersion
(Build).
Accepted Answer

Pls. see my reply in Why is the Cocoa Touch Framework target Build setting set to $(CURRENT_PROJECT_VERSION)?


>where is that environment variable set.


IIRC, when viewing the Info tab, if you right-click and select Show Raw Keys/Values, you'll see the actuals used by those macros are

CFBundleShortVersionString
(Version) and
CFBundleVersion
(Build).

If you do a Google seach for "xcode environment variables" you will find good resources. However, you should be careful with those. Apple does change them from time to time. Like most things Apple, there is little or no documentation. What documentation you do find may or may not be correct depending on a whole bunch of stuff. Generally, you can use them. Just don't be surprised when it breaks.

I thought we already decided that they were macros instead of environment variables?

It's all the same thing. Personally, I wouldn't call them macros. To me, that suggests an inline code expansion in C. Environment variables are essentially the same thing. But when used in the context of a system "environment" like a shell or build system (Xcode) they are more commonly just string replacement variables.

The way to see all environment variable values is to add a run script to your build phases.

Environment variables
 
 
Q