What is the source of Xcode build settings defaults? - xcode

I have two Xcode projects. Neither of them have custom ENABLE_BITCODE setting .pbxproj file. But in one of them it's set by default to YES and in another one it's set to NO.
If I enable Customized filter - it's empty in both project.
Where the settings come from?

You can see sources of particular settings by enabling Levels toggle in build settings.

Related

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.
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:
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. ;)
Yes, they're inherited.
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:
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):
And under the Combined view of All build settings, you'll see the xcconfig listed on the right side:
You'll also see the xcconfig listed under the top-level project target, if you select Build Settings with the project selected:
Approach b): Search the build logs for a property set in your xcconfig.

How to delete user-defined build settings in Xcode 4.3.1

I have created several user-defined build settings in Xcode 4.3.1. I no longer need these settings and want to delete them, but there doesn't seem to be a way to delete them!
I am aware that these are stored in the project settings (project.pbxproj) file located within the xcodeproj file. But I don't want to edit these in a text editor as there are all sorts of repetitions and guids which I don't understand.
Any suggestions on how I can do this within Xcode? (or have they forgotten to add a "delete" button)
Just figured this out myself: you need to make sure you're at the right scope to be able to delete the setting. If you defined the setting at the project scope, no amount of key-bashing will remove it if you're looking at the target-scope. Remember, targets inherit settings from project scope. That last bit is what I tripped over :)
Try selecting a user-defined setting that you created then hit "Delete" button on your keyboard. That works for me when I encountered the same problem.
On Xcode 6:
Select the row and hit Fn + Delete.
Follow the steps below:
Select Project
Tap on the Info tab
Select Configurations
Select Configuration to remove
Press the Delete button on the keyboard
Removing User-Defined build settings depends on where those settings have been created.
Lets assume that you've created one already and named it as PROJECT_SETTING. In order to check your PROJECT related User-Defined settings, you have to select your project first on the project and targets list, then you should see something like this:
Here you can see only PROJECT related settings, and here you have the
only ability edit/delete PROJECT_SETTING.
Besides that if you set up a TARGET, so can add new User-Defined settings there, that only affects that TARGET scope.
You can edit/delete TARGET_SETTING_1 and TARGET_SETTING_2 here, but
PROJECT_SETTING is read-only, as it is inherited from your
PROJECT settings.
Here you will notice that your TARGET contains your PROJECT User-Defined settings and also your TARGET related User-Defined settings marked as bold letters. This helps you to know which setting can be edited on this level.
You won't be able to delete your settings here if that was created under PROJECT scope, and also editing a PROJECT related User-Defined settings will result a newly created settings that affects only the selected TARGET.
Also if you prefer more visibility on Build Settings, you can select Levels view instead of Combined view, so you should see it more separated:
Select one of them and press keyboard's delete button.
There's a caveat to these answers: If you're using a Build Configuration File (.xcconfig) it doesn't seem possible to delete the user-defined settings generated from these files directly on either the project or target level in the "Build Settings" GUI. You'll have to delete the flag and its value from the configuration file and rebuild the project. If you're using multiple build configuration files that use the same flag, you'll have to delete them from each file.
Although settings that come from these configuration files are displayed in the User Defined build settings section (just like any other user-defined flag that one would create from the GUI), they are not written to the .xcodeproj file like the settings that one adds from the GUI are (which probably prevents them from being able to be deleted from the GUI). They are also not displayed in bold text like these GUI-added settings are.

Why does VS force my build to x64?

Before I build, I choose x86 (or Any CPU, too) in the Properties tab for the project.
I save these properties, and if I re-open the Properties tab it's back to x64 as the platform and target, why?
Choosing a build configuration in Properties doesn't actually change the active build configuration. It only allows you to switch between the various build configurations that are defined for your project so that you can edit the settings for each of those configurations. It's only a configuration selector.
The easiest way to change the active build configuration is using the drop-down boxes on the toolbar:
Those commands should be present in your toolbar by default. If you don't see them, follow these steps to get them back where they belong.
Make sure that your .csproj file is not readonly.
Make sure that your changing the build target, not the configuration selector.

precompiled header name gets stuck

I'm new to xcode and I must be missing something.
Create a new command-line project. Call it tempprog (for instance).
Select Project/Edit Project Settings.
Edit the name of the prefix header (tempprog_Prefixz.pch).
Build - it will fail, of course, looking for tempprog_Prefixz.pch
Now change the name of the prefix header back to tempprog_Prefix.pch.
Build again - it should work, but doesn't. It's still looking for tempprog_Prefixz.pch
Cleaning does not rectify the situation. What am I missing here? Where is the Prefixz.pch name being retained? If you look in the build output at the ProcessPCH command you can see that it still wants to use Prefixz.
It turns out there's a system of setting priorities.
From Working With Xcode Build Settings:
The levels at which build settings can be set, and their precedences are:
xcodebuild command-line flags (only applicable for command-line builds)
The target, editable via a target's Info inspector
The project, editable via a project's Info inspector
Xcode application settings, as set in Xcode > Preferences...
Xcode's built in defaults
The user environment, perhaps as set in a user's ~/.MacOSX/environment.plist file
Restarting your mac fixes the problem.

XCode Edit Project Settings vs Edit Active Target

What is the difference between these 2 options under the Project menu drop-down?
Normally I just adjusted things in the Project Settings (which adjusts the info.plist, right?).
Today I needed to change the name of my project. Initially i changed the Product_Name from the Edit Project Settings -> Build window. But that didnt change the name.
Then I tried changing the the Product_Name from the Edit Active Target -> Build window, and that seemed to do the trick.
So again, what's the difference? XCode never fails to confuse me just when im beginning to think i have it all figured out! Argh!!!
Project settings apply to all targets in your project. Target settings apply only to that specific target. You likely have only a single target which can make the two sets of settings confusing and appear redundant.
If a setting is set (appears in bold) for both the project and a target, the target setting overrides the project setting.
Target settings which aren't set (do not appear in bold) are inherited from the project settings. Project settings which aren't set (do not appear in bold) are inherited from Xcode's default settings.
If a setting (either project or target) is set (appears in bold) and you instead want to inherit that setting, select the setting and press Delete.
I suggest you prefer using the target settings. Use the project settings for larger, multi-target projects where you really do want to share settings across targets.
It's worth adding that properties set at project level are not automatically inherited from the different configurations / targets of your project: in order to inherit properties that are set at project level you need to set the value $(inherited) in the fields where you actually want to inherit such properties.

Resources