[CMake] CMake 2.8, Xcode generator and XIB files

Daniel Dekkers d.dekkers at cthrough.nl
Sun Oct 2 10:03:46 EDT 2011


With...

SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PLIST_TEMPLATE} )

... we set a path to a Info.plist template (we actually got separate ones for iOS and OSX). Maybe you can call them what you want, haven't tried. "Info.plist.in" would be good. I'll try.
These templates look like normal property list files except that they can contain CMake variable names, something like this:

...
	<key>CFBundleDisplayName</key>
	<string>${APP_NAME}</string>
...
	<key>CFBundleIdentifier</key>
	<string>${APP_IDENTIFIER}</string>
...

where ${APP_NAME} and ${APP_IDENTIFIER} are substituted by CMake automatically while a new Info.plist is generated in path/to/build//CMakeFiles/[APP_NAME].dir. 
This file is included in the Xcode project, it will appear in the Application->Resources folder. Not in the top level Resources folder of the project.

I'm not exactly sure what triggers this CMake behavior, I guess "Xcode" generation always implies: "Info.plist" generation. 
Or it's dependent on another setting (platform, architecture). Couldn't find that in the documentation. 
But i was copying the Info.list myself (with ADD_CUSTOM_COMMAND) and that gave all kinds of problems, like code signing errors.

I think it is possible to *not* let CMake perform the substitutions and just copy the template, but I haven't got that working yet. That would be handy because for some values you would just want to keep the ${...} entries unchanged. Xcode uses the same notation for values that are substituted later on.

Also see
https://lists.secondlife.com/pipermail/sldev/2008-September/011839.html

Thanks,
Daniel Dekkers

On Oct 2, 2011, at 2:51 PM, g4 at novadsp.com wrote:

> Hi Daniel, can you clarify this a bit? Do you have an example?
> 
> On 30/09/2011 15:23, Daniel Dekkers wrote:
>> Correction: not the Info.plist. That is treated differently because CMake generates its own for the project.
>> You can set a "template" Info.plist though where ${VARIABLE} entries are subsituted with (known) CMake variables.
>> 
>> On Sep 30, 2011, at 4:14 PM, Daniel Dekkers wrote:
>> 
> 
> Thx++
> 
> 



More information about the CMake mailing list