Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode easily add multiple files to a target

Tags:

xcode

I've created a new target for unit tests in Xcode 4.2, and obviously i need to bring in certain application files into that target. But there is a lot, and it seems cumbersome to click each .m file then click TargetMembership and tick the new target box.

Is there an easier way to do this in Xcode that i'm missing?

Thanks

like image 652
bandejapaisa Avatar asked Oct 11 '11 21:10

bandejapaisa


People also ask

How do I add files to target in Xcode?

I include them in the project by right-clicking on the project folder in the project view in Xcode, and selecting "Add Files to ...". I then navigate to the folder containing the source files, click on the folder and select "Add." With the options "Create folder references" and "Add to target [target name]".

How do I duplicate targets in Xcode?

Go to project's settings in the Project Navigator panel. Under the Targets sections, right click the existing target and select Duplicate to copy your existing target.

What is the difference between project and target in Xcode?

An project is a repository for all the files, resources, and information required to build one or more software products. A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.


1 Answers

I though't i'd return to this with an improved answer. It's still difficult to do this via Xcode main interface, as if you filter for .m and try and do CMD-A to select all, it selects the folders too, so you can't add these to the target.

However, if you go to Project Settings > Build Phases > Compile Sources. You can click the + button, filter .m files, and you can CMD-A to select all here.

This works.

screenshot

like image 62
bandejapaisa Avatar answered Oct 04 '22 11:10

bandejapaisa