I'm building a project with many individual test programs in it; each test program is its own target.
There are a number of settings that each target in "Build Settings" such as several preprocessor macros, and about half a dozen libraries in the "Build Phases" tab.
Every time I create a new target, I have to manually enter those values all over again. Or I can duplicate an existing target and edit its build sources.
Neither solution is easy. Is there any way to simply copy the build settings from one target to another?
Add a configuration settings file to your project. Choose File > New > File to create a new file. The configuration setting file is in the Other section under iOS or Mac.
Put the build settings you want to copy into the configuration settings file. Select your project from the project editor and click the Info button.
Use the Configurations section to tell Xcode to use your configuration settings file. You can find more detailed information on configuration settings files in the following article:
Xcode Build Configuration Files
Related
Is there a way of checking whether your xcode project is using the .xcconfig configuration file with which you have supplied it?
What I mean is, if there is some way of 'printing' a statement eg debugging, like #warning, #error, printf, etc...?
The reason being is that I have set up some configurations, and I feel they are not being used...
Just open the project navigator and select "Build Settings". If you have specified the config files correctly and added any setting to that file, a new column will appear, one for the xcconfig file for each target and on for the project as whole. The column to the far left is a "sum" of all you settings, and there you can verify that the settings you look for are set.
EDIT: Adding some pictures to show the columns with different config file settings.
Build settings without any property in the projects xcconfig file:
And the same with some settings in the projects xcconfig file:
The same applies for the Target as seen in the following two pictures:
No settings in the targets config file:
Some settings in the targets config file:
Check out this beginners tutorial for more visual examples and a step-by-step guide:
http://www.jontolof.com/cocoa/using-xcconfig-files-for-you-xcode-project/
Good luck!
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.
I have 3 targets in my project and I want to set a custom build path for one of the targets. How do I set the build path for just one target in my project?
Use the Build Products Path build setting to set the custom build path for a single target.
Update
I noticed something new in Xcode 5. If you choose File > Project Settings and click the Advanced button, you can choose a Legacy build location that uses the target's build products location.
I am using Advanced Installer with Visual Studio 2010.
I managed to create an .aip project, but when I want to add the files from the relevant VS projects, I have to choose the exact location of these files.
I want to use more then one build configuration so I can use config transforms to change my .config files depend on the build configuration I choose.
This is a problem for me because when I compile in Debug the .exe & .dll files goes to bin\Debug, but when I compile in, lets say, Staging these files goes to bin\Staging.
How can I get Advanced Installer to get the right files, meaning get them from the target folder of the build configuration I chosen?
Advanced Installer does not support this by default, but with a little bit of tweaking you can get this working. Let me explain how:
the first requirement is to have your output folders generated by VS in the same parent folder, as you have them both placed in "bin\".
now you need to open your project in Advanced Installer GUI and do the following:
create two builds in Media page, called Debug and Staging
create a property called "Configuration" or what name would you like, from Install Parameters page
in the New Property dialog you will have options to set per-build values for your property. Set them to "Debug" and "Staging", i.e. the names of the folders created by VS
now go to File -> Options -> Path Variables and define a new path variable with your full path for the debug/staging, the one you current have in the project.
from the Home tab, in the toolbar, use the "Convert Paths" wizard and then save the project.
Now, it comes the tricky part, you will need to edit the project file in a text editor, like Notepad++, capable of saving the file in UTF-8 format. Once you open the file look for this XML node:
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
<ROW Name="BIN_DIR" Path="<your path>\bin\Debug" Type="2" Content="0"/>
You might have multiple variables here if you are already using this feature. You need to edit the value and replace "Debug" with "[|Configuration]".
Now you can save and build the project and it should pickup the correct files for each of the two builds.
I would like to know if it is possible to change compile settings without modifying the xcode projects.
Example, adding -Wno-unused-parameter to CFLAGS in such way that it will be used by Xcode when building projects.
This has to work in both case: build made from xcode in GUI or from the console.
If someone asks about why, let's say that the number of projects is quite big and that you may want to alter the options only temporary.
Put the compiler settings you want to change in a configuration settings file. You can create a new one by choosing File > New > New File. The configuration settings file is in the Other group under both iOS and Mac OS X.
To tell an Xcode project to use the configuration settings file, select the project file from the project navigator to open the project editor. Select the project from the left side of the editor. Click the Info button at the top of the editor. You should see a list of build configurations in the editor. Click the disclosure triangle next to a build configuration to have it use a configuration settings file.