Hi Jerry,

I've been battling with .xibs for weeks. What I am finally doing now is not 
trying to compile and add them to the bundle via CMake myself using custom 
commands.
I just add them as sources to ADD_EXECUTABLE(... ${RESOURCES}) and set
SET_TARGET_PROPERTIES(... PROPERTIES RESOURCE ${RESOURCES}) to make Xcode 
"aware" of them. They then appear in the top level /Resources folder and Xcode 
will compile them and place them in the bundle. The same with icons, 
splashscreens, Info.plist, Settings.bundle, etc.

Two problems with that..
- You need Xcode. Although i haven't tried building from the command line in 
any way.
- If you have multiple projects, each with it's own resources, they tend to all 
clump together in the top level /Resources folder. Not what you want. I haven't 
found a way to seperate them into the individual projects yet. Don't even know 
if that is possible with Xcode.

Thanks,
Daniel Dekkers

On Sep 30, 2011, at 3:22 PM, [email protected] wrote:

> 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
> 
> 
> 
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to