Xcode 的搜索路径设置中的 $(inherited) 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15343122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:45:10  来源:igfitidea点击:

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

xcode

提问by Martin Berger

What is the $(inherited)search path setting?

什么是$(inherited)搜索路径设置?

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.

我已经修改了关于 iPad 的 OpenSSL 的头文件和库搜索路径设置,这个问题以及给定路径的递归选项是主要的罪魁祸首。

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

当我重新排列搜索路径以首先查看目录然后查看 时$(inherited),iPad 版本正在运行。

采纳答案by Thomas

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.

我也在找文档。但是我做了经验,$(inherited)可以用来将构建设置从项目级别继承到目标级别。在项目级别定义库或标头搜索路径时,您可以$(inherited)在目标构建设置中使用这些搜索路径在项目目标的搜索路径中使用。

回答by onmyway133

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

如果您转到目标构建设置,然后切换到关卡视图

Alt text

替代文字

You can see the flow of inheritedfrom right to left

你可以看到inherited从右到左的流动

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

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

所以 in inheritedTarget 意味着 Target 从 xcconfig 和 Project 继承设置

回答by lal

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

通过在 xcconfig 文件中重新分配该变量的值来覆盖在项目或目标级别上设置的构建设置变量的示例。

// 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 -ObjCis going to be overridden by the new value -framework Security.

^ 使用此编译时, OTHER_LDFLAGS 的先前值-ObjC将被新值覆盖-framework Security

Example of Inheritingbuild 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.

通过附加到 xcconfig 文件中该变量的先前值来继承在项目或目标级别上设置的构建设置变量的示例。将其$(inherited)视为可用于获取变量的现有值的特殊变量,以便对同一变量的赋值不会造成破坏性。

// 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.

^ 使用此编译时, OTHER_LDFLAGS 的值将是-ObjC -framework Security.

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

https://pewpewthespells.com/blog/xcconfig_guide.html 中找到的示例

回答by Emerald Weapon

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

附录:当您通过单击 Target Membership 右侧窗格将库添加到目标时,会自动填充$(inherited)Build Settings->Library Search Path。否则不会发生这种情况。