[CMake] Any experiences with ICU genrb?

Gerhard Grimm ggrimm at detec.de
Mon Mar 2 10:55:33 EST 2009


Hi Eric,
 
genrb does not create libraries to link against, but binary resource files that will be loaded by an application using ICU at runtime.
Here's an example how we are using genrb in our project:

macro(IcuResources Encoding)
   set(${CurrPkg}_resdir ${CMAKE_INSTALL_PREFIX}/lang/${CurrPkg})
 
   file(MAKE_DIRECTORY ${${CurrPkg}_resdir})
   
   foreach(Locale ${ARGN})
      set(${CurrPkg}_${Locale}_res ${${CurrPkg}_resdir}/${Locale}.res)
      
      add_custom_command(OUTPUT ${${CurrPkg}_${Locale}_res}
                         COMMAND ${ICU_GENRB} -d${${CurrPkg}_resdir} -k -e ${Encoding} ${CMAKE_SOURCE_DIR}/${CurrPkg}/${Locale}.txt
                         MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/${CurrPkg}/${Locale}.txt
                         VERBATIM)
 
      list(APPEND ${CurrPkg}_ICU_resources
                  ${${CurrPkg}_${Locale}_res})
   endforeach(Locale)
endmacro(IcuResources)

Our software consists of several packages, each of which uses its own set of ICU resources. The name of the current package is contained in the CurrPkg variable.
ICU_GENRB contains the full path of the genrb utility.
An example call of this macro would be:
 
IcuResources(cp1252 root de)
 
This would compile the source files root.txt (for the root locale, usually English) and de.txt (for the German locale). Both source files are assumed to be encoded in cp1252.
The output files would be root.res and de.res.
For more information and examples, see the file "ResourceManagement.html" in the ICU User Guide.
 
Best regards,
 
Gerhard

-----Ursprüngliche Nachricht-----
Von: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org]Im Auftrag von E. Wing
Gesendet: Samstag, 28. Februar 2009 01:30
An: cmake at cmake.org
Betreff: [CMake] Any experiences with ICU genrb?


Anybody out there know anything about ICU and genrb? I need to convert a build system that uses genrb.

As I understand it, genrb is a tool that creates a static library from some input and you are supposed to link against it.

So I have 2 different questions about this.

1) Using CMake, what is the correct way to set this up?
I assume I will need ADD_CUSTOM_COMMAND with OUTPUT. Do I just use TARGET_LINK_LIBRARIES with the output that it provides?

2) Is this genrb tool actually cross-platform and going to handle all the different compilers? For example, will it generate the correct output that both gcc and Visual Studio can handle? Does it be used to generate Universal Binaries on the Mac? If neither of these things are true, do people have alternative ways of accomplishing what genrb does in a truly cross-platform way?

Thanks,
Eric





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090302/fb2848d1/attachment-0001.htm>


More information about the CMake mailing list