[CMake] OS X Carbon Rez...

Mike Jackson imikejackson at gmail.com
Tue Aug 1 13:49:26 EDT 2006


On Aug 1, 2006, at 1:35 PM, William A. Hoffman wrote:

> At 12:49 PM 8/1/2006, Mike Jackson wrote:
>> OK..
>>   So after the last bit of help I now have an executable that
>> runs.. almost.. As with Carbon Apps on OS X I have to manually run:
>>
>>  ADD_EXECUTABLE( ImageImporter ${SAMPLE_SRCS} ${SAMPLE_MOC_SRCS} $  
>> {SAMPLE_UI_HDRS} )
>
> Try this:
>
>
> ADD_EXECUTABLE( ImageImporter
>  MACOSX_BUNDLE
>  ${SAMPLE_SRCS} ${SAMPLE_MOC_SRCS} $ {SAMPLE_UI_HDRS} )
>
> -Bill
>

And there ya have it.... One OS X .app package.. now to go get some  
lunch...

Of course I am assuming to make this truly cross platform I would  
need to check if I am building on OS X and then use that line  
otherwise use the line that I had before. So this is what I have now.

# ------------------ FIND THE  
ZLIB---------------------------------------------
   FIND_LIBRARY(Z_LIBRARY z
     /usr/local/lib
     /usr/lib
   )

#--------------- Add OS X Specific Libraries  
-----------------------------------
# here we instruct CMake to build "ImageImporter" executable from all  
of the source files
   IF ( CMAKE_SYSTEM_NAME MATCHES Darwin )
		INCLUDE_DIRECTORIES ( /Developer/Headers/FlatCarbon )
		FIND_LIBRARY(CARBON_LIBRARY Carbon)
		FIND_LIBRARY(QUICKTIME_LIBRARY QuickTime )
		FIND_LIBRARY(APP_SERVICES_LIBRARY ApplicationServices )
		SET(EXTRA_LIBS ${CARBON_LIBRARY} ${QUICKTIME_LIBRARY} $ 
{APP_SERVICES_LIBRARY} ${EXTRA_LIBS})
	  ADD_EXECUTABLE( ImageImporter MACOSX_BUNDLE $ 
{HDFIMAGE_IMPORT_SRCS} ${HDFIMAGE_IMPORT_MOC_SRCS} $ 
{HDFIMAGE_IMPORT_UI_HDRS} )
	ELSE ( CMAKE_SYSTEM_NAME MATCHES Darwin )
	  ADD_EXECUTABLE( ImageImporter ${HDFIMAGE_IMPORT_SRCS} $ 
{HDFIMAGE_IMPORT_MOC_SRCS} ${HDFIMAGE_IMPORT_UI_HDRS} )
	ENDIF ( CMAKE_SYSTEM_NAME MATCHES Darwin )


# last thing we have to do is to tell CMake what libraries our  
executable needs,
# luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
TARGET_LINK_LIBRARIES( ImageImporter ${QT_LIBRARIES} ${EXTRA_LIBS} )

--------
Mike Jackson
imikejackson <at> gmail <dot> com





More information about the CMake mailing list