Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CocoaPods' Pods.xcconfig conflicts with existing ones

I've a project with several targets. There is a xcconfig file associated to the project and several xcconfig files associated to the targets.

Now I want to incorporate a third party library via CocoaPods. After $ pod install CocoaPods screwed the original project since it associates its own xcconfig file Pds.xcconfig to the target of the original project. This completely ignores and overwrites the settings defined in the original xcconfig associated to the project, and switched out the original xcconfig file associated to the target(s). Hence, the project ended up screwed.

For example, Cocoapods defines the following in its Pods.xcconfig which is associated to each target:

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1

I have different configs for each configuration, for example for Debug the config file osx.debug.xcconfig defines

GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 DEBUG_LOG=2 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0

What's a reasonable and viable approach to solve such conflicts?

Edit:

I've searched through the CocoaPods issues list on GitHub. There seems to be a large number of issues related to xcconfig files, some of them more than 2 years old. They are discussed, and then closed, but - as it occurred to me - the issue has not yet been solved.

IMHO, this is a fundamental and a basic problem: there is a project which uses xcconfig files. Then, one wants to include a third party library via CocoaPods. After executing pod install, the project is screwed up.

So, what's up with this?

like image 746
CouchDeveloper Avatar asked Sep 25 '13 16:09

CouchDeveloper


1 Answers

You can still have your cake and (partly) eat it. Your targets' xcconfig file can include the cocoapods one:

#include "../Pods/Pods.xcconfig"
MY_SETTING = YES
...

However, the part you still can't eat is when you want to specify the flags already set in Pods.xcconfig. I can't find a way to add to paths that Cocoapods already set in the included file, e.g. you'd want this:

HEADER_SEARCH_PATHS = $(HEADER_SEARCH_PATHS) MyOtherIncludes

However this line simply drops the Cocoapods header search path, leaving only MyOtherIncludes :-(

One workaround for this should be to move MyOtherIncludes to the project's xcconfig files, which Cocoapods doesn't touch. Unfortunately this didn't work for me, YMMV.

like image 143
Graham Perks Avatar answered Sep 23 '22 11:09

Graham Perks