Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcconfigs: How to set up multiple configurations for a target

I can't tell from the Xcode UI if my target is using both the Warnings and Pods xcconfigs, or just one.

Xcode xcconfig UI

I've looked at the build log in Xcode, and a search for either xcconfig name comes up empty. How can I tell what's happening behind the scenes?

Xcode's filtered build log shows no results for either configuration file:

Xcode build log search for Warnings.xcconfig

Xcode build log search for Pods.xcconfig

like image 956
cbowns Avatar asked Oct 01 '22 16:10

cbowns


2 Answers

The projects are based on "Warnings" and the targets on "Pods". The settings still cascade from project down to target but in this example "Pods" does not apply to any project. Generally I maintain sets of xcconfig files that are best suited to "seed" project settings and separate files suitable for seeding targets.

Also note that build setting propagation occurs separate from a build. Changes to xcconfig files will immediately affect project and target settings. This is why you won't see anything in a build log about them.

Think of all settings for a target build being derived from target settings which may inherit from project settings, which inherit from system default settings. Then independently of that think of xcconfig files as a way of automatically imposing settings at either the project or target level, at a lower priority to manual edits you make in the settings UI.

See? Simple. ;)

like image 129
danielpunkass Avatar answered Oct 13 '22 01:10

danielpunkass


  1. Yes, they're inherited.

  2. There's two ways to tell:

Approach a): Look at the build settings for the target.

To find out if Warnings.xcconfig is set up for the RACTest target below:

Project info pane

We select the RACTest target from the dropdown my mouse was over (where that "Select a project or target" hover text is appearing in the first screenshot):

Selecting the application target

And under the Combined view of All build settings, you'll see the xcconfig listed on the right side:

Build settings for RACTest target

You'll also see the xcconfig listed under the top-level project target, if you select Build Settings with the project selected:

Build settings for RACTest project

Approach b): Search the build logs for a property set in your xcconfig.

like image 23
cbowns Avatar answered Oct 12 '22 23:10

cbowns