[CMake] CMake 2.8, Xcode generator and XIB files

g4 at novadsp.com g4 at novadsp.com
Fri Sep 30 09:22:10 EDT 2011


My CMake rules to convert a .XIB file to a .NIB file in the application 
bundle work for makefile builds.

However I cannot get the same result when using the Xcode generator. 
Does anyone have a working example for XCode 3.X or 4 they can share?

The cmakelists.txt script is

Message("We are generating for Xcode ${this_target}")

# Make sure the '.App' directory tree is correctly created before we build
# copy our plist and icon file into place
add_custom_command (TARGET ${this_target} PRE_BUILD
                      COMMAND mkdir -p 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app
                      COMMAND mkdir -p 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents
                      COMMAND mkdir -p 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents/MacOS
                      COMMAND mkdir -p 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents/Resources
                      COMMAND mkdir -p 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents/Resources/English.lproj
                      COMMAND cp -n 
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents
                      COMMAND cp -n ${CMAKE_CURRENT_SOURCE_DIR}/WV.icns 
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents/Resources
                      )

# command to convert any existing IB .xib to .nib in the .APP folder
add_custom_command (TARGET ${this_target} POST_BUILD
                       COMMAND ${IBTOOL} --errors --warnings --notices 
--output-format human-readable-text
                               --compile  
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/WebViewExample.app/Contents/Resources/English.lproj/MainMenu.nib 

                              ${CMAKE_CURRENT_SOURCE_DIR}/MainMenu.xib
                      )

This appears to fail with at the first cp command ...

Thx++

Jerry





More information about the CMake mailing list