Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying preprocessor macros for a cocoapod dependency, without forking it

I have an XCode workspace managed by Cocoapod with a few dependencies to external libraries. One of them, MTDates, extends NSDate and NSDateComponents with either prefixed methods, or non-prefixed if a certain preprocessor macro is defined (which is what I want).

There are a few places where I can put the preprocessor macro definition in order to have the compiled library provide the non-prefixed methods, but all seem to be reset as soon as I ask Cocoapod to update the project, which leads me to think that these configs are driven by the pod spec. These include :

  • The pod's target build settings
  • The pod's private .xcconfig file in Cocoapod's Targets Support Files

Changing the pod's spec would require to manage my own version of the library, whereby losing the ability for cocoapods to update it when a new version comes around. So my question is: is there a way to specify a preprocessor macro for a cocoapod dependency, without forking the pod and changing the pod's spec itself?

Edit:

There is an open issue about this, that seem to be just around the corner.

like image 795
matehat Avatar asked Jul 28 '13 13:07

matehat


1 Answers

as you mentioned 'The pod's private .xcconfig file in Cocoapod's Targets Support Files', i do this resolved my problem.

s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 IOS=1' }
like image 171
zhonglaoban Avatar answered Nov 16 '22 00:11

zhonglaoban