0

Are compiler settings set per project or once and for all?

For example, can one declare:

For all projects i create from this day forth, until told otherwise, treat all warnings as errors

Anton Korobeynikov
  • 9,074
  • 25
  • 28
James Raitsev
  • 92,517
  • 154
  • 335
  • 470

1 Answers1

1

If you're using Xcode*, just use shared/global xcconfig files. Definitions at the project and target levels have precedence if defined, so you can make exceptions and/or combine them in many ways.

Xcconfig Crash Course:

This Q+A will explain the configuration.

Then you just fill the xcconfig file with the build settings you want, like so:

ADDITIONAL_SDKS = 
ARCHS = x86_64
SDKROOT = macosx10.7
ONLY_ACTIVE_ARCH = NO
SUPPORTED_PLATFORMS = macosx
VALID_ARCHS = i386 ppc ppc64 ppc7400 ppc970 x86_64

Other notes:

  • You can #include xcconfig files in xcconfig files (with some restrictions)
  • You can drag+drop build settings from Xcode's build settings view to a text file.

So, if all you want is "Treat warnings as errors", your xcconfig would have this:

GCC_TREAT_WARNINGS_AS_ERRORS = YES
Community
  • 1
  • 1
justin
  • 104,054
  • 14
  • 179
  • 226
  • Updated tags to include IDE. Can you please tell me more about `shared/ global xconfig files`? Where are they? How should they be edited? – James Raitsev Dec 02 '11 at 05:34