Specifying preprocessor macros for a cocoapod dependency, without forking it
Looking at Cocoapods documentation, I don't think this is possible just yet, I think what you can do is to copy the pod spec - make the changes you want (e.g s.prefix_header_contents = #define symbolToDefine
) and then add it to your local specs with a different name, and use that in your pod file. When a new version comes out unfortunately, you'd have to go in and change the tag number (and other stuff depending on the changes).
This functionality is now available. Here is an example of what you could put at the bottom of your Podfile to add a macro based on a specific configuration.
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == "Pods-TweaksBuildConfigurationsDemo-Tweaks"
target.build_configurations.each do |config|
if config.name == 'QA'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FB_TWEAK_ENABLED=1']
end
end
end
end
end
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' }