The best way I found for doing this is to create an alias to the /usr/lib directory inside your templates folder. From there, you can access all the libs which are in /usr/lib, even the ones which are aliases themselves.
First, I create templates by editing the .plists in XCode, not by editing the xml representations themselves. So, that's how I will be explaining the steps I took to include static libraries into my template.
1) I have a project template:
iPhoneOS.platform / Developer / Library / Xcode / Templates / Project Templates / Application / C4 Application.xctemplate
(In Xcode 4.3 the Project Templates / Application can be found directly in the Xcode.app by right-clicking the bundle and choosing Show Package Contents)
The guts of this folder look like this:
2) As you can see in the image above, I created an alias for the lib folder (/usr/lib
) that contains static libraries and moved the alias into my .xctemplate folder.
3) In my TemplateInfo.plist file I specify 2 things: a Dictionary and a Node. I put them inside the Definitions and Nodes of the TemplateInfo.plist
First, in the Definitions node I specify a dictionary called:
Libs/libalias.dylib
Inside this lib I have 2 strings
Group : Libs
Path : lib/libalias.dylib
The node looks like this:
It is important that the syntax be exactly like this, and most importantly that the name of the Dictionary itself specifies the library you want to import. In this case I am importing the libalias.dylib library.
It is also important that the Path be lib/libalias.dylib because this will point to the alias which points to your /usr/lib folder.
Second, in the Nodes array I specify an item as a string which is called Libs/libalias.dylib (note: the exact same name as the Dictionary I specified in Definitions)
This is what the Node Item should look like.
4) Once you have these things set up, you can create a new project with your lib already included.
NOTE: because I called my Dictionary Libs/... and specified it's Group as Libs the library I am importing appears in a subfolder called Libs in my Project Navigator.