What is $(inherited) in Xcode's search path settings?

What is the $(inherited) search path setting?

I've modified the header and library search path settings regarding OpenSSL for iPad and this issue along with the recursive option for given path was the main culprit.

When I rearranged my search paths to first look into directories and then into $(inherited), the iPad builds were working.


Solution 1:

If you go to Target Build Settings, and switch to Level view

Alt text

You can see the flow of inherited from right to left

Resolved <- Target <- xcconfig <- Project <- iOS Default

So in inherited in Target means that Target inherits settings from xcconfig and Project

Solution 2:

I'm looking for a documentation, too. But I made the experience, that $(inherited) can be used to inherit build settings from the project level to the target level. When you define library or header search paths at the project level you can use $(inherited) in the target build settings to use these search paths in the search paths of the project targets.

Solution 3:

Example of Overriding build setting variables set on the Project or Target level by reassigning the value of that variable in a xcconfig file.

// Variable set in the project file, previous level
OTHER_LDFLAGS = -ObjC

// lib.xcconfig
OTHER_LDFLAGS = -framework Security

^ When compiling with this, the previous value of OTHER_LDFLAGS -ObjC is going to be overridden by the new value -framework Security.

Example of Inheriting build setting variables set on the Project or Target level by appending to the previous value of that variable in a xcconfig file. Think of $(inherited) as a special variable that can be used to get the existing value of a variable so that assignment to same variable isn't destructive.

// Variable set in the project file, previous level
OTHER_LDFLAGS = -ObjC

// lib.xcconfig
OTHER_LDFLAGS = $(inherited) -framework Security

^ When compiling with this, the value of OTHER_LDFLAGS is going to be -ObjC -framework Security.

Example found at https://pewpewthespells.com/blog/xcconfig_guide.html