2

I'm trying to build a good architecture for my iOS app and I'm encountering problems with my xcconfig configuration. I have a couple of CocoaPods and it is only natural that they contain warnings. I've been silencing those with inhibit_all_warnings! directive on top of CocoaPods integration. So my Podfile looks something like this:

platform :ios, '7.0'

inhibit_all_warnings!

source 'https://github.com/CocoaPods/Specs.git'

pod 'AFNetworking', '~> 2.x'
...

This actually works, no warnings are displayed when building the project with this configuration.

But I am trying to force a very strict environment when building the app, so I've created a couple of .xcconfig files that force errors on warnings and enable almost every warning possible. This is the part of the xcconfig file that actually does this:

GCC_TREAT_WARNINGS_AS_ERRORS = YES;
WARNING_CFLAGS = -Weverything -Wno-objc-missing-property-synthesis -Wno-unused-macros;

Both lines are working correctly, but the problem appears that CocoaPod library's warnings are also treated as errors. Disabling GCC_TREAT_WARNINGS_AS_ERRORS will make project compile again, but warnings are back from CocoaPods.

So my question is:

How would I set my .xcconfig files correctly, that WARNING_CFLAGS would be used only on project files, not library files?

Or how to make inhibit_all_warnings! pod directive work when WARNING_CFLAGS configuration variable is set, as it seems to ignore it in this case?

Thanks for all help!

Legoless
  • 10,942
  • 7
  • 48
  • 68

1 Answers1

0

This "bleed through" of warnings likely stems from your usage of the -Weverything flag in your build environment. I used a similar one and experienced the same problem until I stumbled today upon this answer on a related question.

Long story short : The use of -Weverything is strongly discouraged by the clang developper writing the article because it even includes warnings that are buggy or still in development. Prefer using -Wall, -Wextra and optionally -Wconversion if you need a stricter build environment. Cocoapods will then respond correctly and hide warnings from the pods.

Community
  • 1
  • 1
  • I've managed to get this working, even with -Weverything flag, but still do not know exactly why did it happen this way. – Legoless Oct 28 '14 at 14:36