[CMake] Building NIB based Cocoa application

Tron Thomas tron.thomas at verizon.net
Thu Oct 30 00:58:20 EDT 2008


I have made some progress, and I'm still having problems.

The first difficulty I had was with the Info.plist file.  It seems that 
CMake was specifying it's own Info.plist even though I tried to include 
one as a source file to the target.

I eventually got the build to use the proper Info.plist with entry like 
this in the CMakeLists.txt file:

set_target_properties(NibTarget PROPERTIES MACOSX_BUNDLE_INFO_PLIST
    ${CMAKE_SOURCE_DIR}/Info.plist)

I also believe I can get a compiled NIB file placed in the application 
bundle.  If I have a NIB file in a directory name English.lproj, I can 
do something like this:

set_source_files_properties(English.lproj PROPERTIES MACOSX_PACKAGE_LOCATION
    Resources)

This also requires that I specify English.lproj as a "source file" for 
the target.

In addition, CMake will configure the XCode project so it adds the path 
to the  English.lproj directory as a "file" in the Xcode project.  I'd 
rather have it include the files contains in the directory instead.  
Also, I cannot get resource files to show up in the desired Xcode 
group.  CMake insists on placing them directly into the target group.  I 
would be nice to place them where ever I wanted.

Again this works fine with a compiled NIB.  However, if someone wants to 
use the new .xib format, things do not work so well.

Normally when a .xib file is added to an Xcode project, Xcode will 
compile the .xib into a valid NIB file using a command like this:

/Developer/usr/bin/ibtool --errors --warnings --notices --output-format 
human-readable-text --compile 
/Projects/NibTarget/build/Debug/NibTarget.app/Contents/Resources/English.lproj/MainMenu.nib 
/Projects/NibTarget/English.lproj/MainMenu.xib

I have not figured out how to make CMake configure the Xcode project so 
this compilation will take place.

What do people know about how this can be done?

Sean McBride wrote:
> Well, since no one else replied, I'll just say that last time I tried, I
> was not able.  But I am far from a CMake expert.  What is not working? 
> IIRC, for me, it was a problem getting things like nibs and other files
> into /Resources.  But that was a long time ago that I tried...
>
>   



More information about the CMake mailing list