[CMake] OS X Bundle startup command

Timothy M. Shead tshead at sandia.gov
Fri May 29 14:23:56 EDT 2009


Michael Jackson wrote:
> 
> 
> On May 29, 2009, at 11:49 AM, Timothy M. Shead wrote:
> 
>> Tobias Sauerwein wrote:
>>> Hi Everyone
>>> In my attempt to get cmake/cpack to produce a propper OS X bundle,  
>>> I  hit a problem. We use a launcher script written in applescript  
>>> which  is compiled in the build process. Before producing the  
>>> bundle with  cpack we simply copied the compiled 'applet' file over  
>>> to the actual  bundle. When I set CPACK_BUNDLE_STARTUP_COMMAND to  
>>> point to the  applet it is getting copied over but renamed to the  
>>> bundle name. Can  I prevent that somehow or can I run a script  
>>> right after cmake/cpack  has finished putting the bundle together  
>>> to do some final touches?
>> Tobias:
>>
>> My experience when I was writing the bundle generator was that the  
>> startup command only worked if it matched the bundle name. From your  
>> question there must be some way to control what gets executed when a  
>> user double-clicks the bundle.  Info.plist?
>>
>> Cheers,
>> Tim
>>
>> -- 
>> Timothy M. Shead
>> Data Analysis & Visualization (1424)
>> Sandia National Laboratories
>> 505-284-0139
> 
> from inside the info.plist:
> 
> 	<key>CFBundleExecutable</key>
> 	<string>QImporter_debug</string>
> 
> You can set that to what ever you want. I'm pretty sure that the  
> executable _should_ be in the "MacOS" directory otherwise you can  
> probably put in a relative path: "../bin/myexecutable"

Cool ... so I think a workable solution for Tobias would be to leave 
CPACK_BUNDLE_STARTUP_COMMAND empty, ensure that the Info.plist specified 
with CPACK_BUNDLE_PLIST runs the correct applet file, then use

INSTALL(FILES /path/to/applet DESTINATION ../MacOS/applet)

to put the applet where it belongs in the bundle, without renaming it.

Since the bundle generator relies on the user to generate their own 
Info.plist anyway, it sounds as if renaming the startup command is 
heavy-handed and should be replaced with a straight copy.

Cheers,
Tim

-- 
Timothy M. Shead
Data Analysis & Visualization (1424)
Sandia National Laboratories
505-284-0139



More information about the CMake mailing list