[CMake] MACOSX_PACKAGE_LOCATION usage

JD Smith jdsmith at as.arizona.edu
Mon Jun 25 12:41:20 EDT 2007


I've just started with CMake (what a fantastic breath of fresh air  
after auto{conf,make} hell!).  I've been attempting to build a MACOSX  
application bundle using the MACOSX_PACKAGE_LOCATION with a recent  
CVS CMake build (which I can report correctly elides -isystem, which  
prevents building with templates on OSX in the release version 2.4.6).

Unfortunately, I can't seem to get the indicated file(s) to copy to  
the Resources/ directory within the bundle.  Here's an example of how  
I'm using it:

IF( APPLE )
   ADD_EXECUTABLE( ${PROGNAME} MACOSX_BUNDLE ${hugin_SOURCES})

   SET_SOURCE_FILES_PROPERTIES(
	"${CMAKE_CURRENT_SOURCE_DIR}/${MACOSX_BUNDLE_ICON_FILE}"
   	PROPERTIES
	MACOSX_PACKAGE_LOCATION Resources
   )
   ...

Does the ICON_FILE need some sort of dependency created to actually  
engage whatever code lies behind MACOSX_PACKAGE_LOCATION?  Here's  
another way I'm trying (and failing) to use this property:

		IF( APPLE )
		    SET_SOURCE_FILES_PROPERTIES(
			${_out}
   			PROPERTIES
			MACOSX_CONTENT 1
			MACOSX_PACKAGE_LOCATION
			"Resources/locale/${_file_we}/LC_MESSAGE/${_baseName}.mo"
		    )

Can the PACKAGE_LOCATION be a specific filename like this, if it  
applies to only one file?  If not, how else would you suggest  
renaming the file as it is moved automatically into location within  
Resources/?  Does MACOSX_CONTENT do anything?

One more issue relates to Info.plist.  Is there a way to include  
DocumentTypes stanzas like:

         <key>CFBundleDocumentTypes</key>
         <array>
                 <dict>
                         <key>CFBundleTypeExtensions</key>
                         <array>
                                 <string>pto</string>
                         </array>
                         <key>CFBundleTypeIconFile</key>
                         <string>HuginFiles.icns</string>
                         <key>CFBundleTypeMIMETypes</key>
                         <array>
                                 <string>application/x-ptoptimizer- 
script</string>
                         </array>
                         <key>CFBundleTypeName</key>
                         <string>Hugin Project</string>
                         <key>CFBundleTypeRole</key>
                         <string>Editor</string>
                         <key>LSTypeIsPackage</key>
                         <false/>
                 </dict>
         </array>

This type of Info.plist stanza is useful for associating file types  
with the application (and indicating a file icon as well).

Thanks very much,

JD Smith




More information about the CMake mailing list