54

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.

4

5 回答 5

51

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

于 2016-06-09T09:57:06.070 回答
46

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.

于 2014-02-04T09:29:31.877 回答
7

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

于 2017-03-27T17:11:03.543 回答
4

ADDENDUM: with $(inherited) Build Settings->Library Search Path is automatically populated when you add a library to a target by clicking in the Target Membership right-hand pane. This does not happen otherwise.

于 2014-09-24T11:57:43.687 回答
0

Xcode $(inherited)

[Xcode ${<variable_name>} syntax]

Xcode variable can be defined on different levels(Project, .xcconfig, Target, Default). When you use Build Settings -> Levels tab you can check hierarchy and Resolved result

$(inherited) uses variable value from super level.

Please note several things:

  • It is useful when you should concatenate the result value like $(inherited)-myPrefix. It is not so useful to use as a standalone expression because even when you delete $(inherited) or any other value from successor(Target is successor of Project) Xcode automatically change this value based on predecessor

  • You are able to set .xcconfig on Project level and Target level, that is why the result hierarchy is not constant

Resolved <- Target <- Target .xcconfig <- Project <- Project .xcconfig <- Default

For example Target = $(inherited)

.xcconfig on Project level enter image description here

.xcconfig on Target level enter image description here

[.xcconfig]

[CocaPods inherit!]

于 2021-05-03T14:10:23.947 回答