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

后端 未结 4 1102
暗喜
暗喜 2020-12-04 21:24

What is the $(inherited) search path setting?

I\'ve modified the header and library search path settings regarding OpenSSL for iPad and this issue alon

相关标签:
4条回答
  • 2020-12-04 21:53

    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

    0 讨论(0)
  • 2020-12-04 21:55

    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.

    0 讨论(0)
  • 2020-12-04 21:56

    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.

    0 讨论(0)
  • 2020-12-04 22:01

    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

    0 讨论(0)
提交回复
热议问题