Xcode xcconfig: Configuring a dependency based on the target

て烟熏妆下的殇ゞ 提交于 2019-12-08 02:18:17

问题


In the quest to resolve the Objective-C namespace issue I'd like to experiment with prefixing a dependency's Objective-C classes based on the target being built.

As an example, suppose I have in my shared library (ObjCStaticLib) a class (CWindow). I have two plugins (A and B) that will use this CWindow. To avoid A's CWindow from colliding with B's CWindow, I want to prefix the CWindow class name at compile time, so A's CWindow becomes ACWindow and B's becomes BCWindow.

I'm looking for a way to communicate to ObjCStaticLib at compile time what prefix it should use to compile itself with. I'm thinking about using xcconfigs to specify a preprocessor macro that the leaf target customizes and that ObjCStaticLib uses. However, I'm not aware of a way for a target to "communicate" with a dependency like that.

I can modify all the sources/projects/etc involved as necessary to implement per-client namespace customization in a dependency.

Does anyone have a good solution for this?

来源:https://stackoverflow.com/questions/1479043/xcode-xcconfig-configuring-a-dependency-based-on-the-target

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!