1. Sergiu Deitsch
  2. icu-cmake

Overview

HTTPS SSH

FindICU.cmake

Author: Sergiu Dotenco
Date: October 17, 2011

Overview

This module allows to locate ICU, and to determine the build configuration required to build against the library. Additionally, FindICU.cmake provides functionality that allows to automate the creation of resource bundles.

Customizable variables

ICU_ROOT_DIR
Specifies ICU's root directory. On Windows the library location typically will have to be provided explicitly using the -D command-line option. Alternatively, the ICUROOT environment variable can be set.

Read-only variables

ICU_FOUND
Indicates whether the library has been found.
ICU_INCLUDE_DIRS
Points to the ICU include directory.
ICU_LIBRARIES
Points to the ICU libraries that should be passed to target_link_libararies.
ICU_C_FLAGS, ICU_C_FLAGS_SHARED
Required C compile flags when building against ICU.
ICU_CXX_FLAGS, ICU_CXX_FLAGS_SHARED
Required C++ compile flags when building against ICU.
ICU_<COMPONENT>_FOUND
Indicates whether the specified <COMPONENT> has been found.
ICU_<PROGRAM>_EXECUTABLE
The path to the specified ICU <PROGRAM>.

Building resource bundles

CREATE_ICU_RESOURCE_BUNDLE (TARGET target NAME name
  FILES file1 [file2 ...] [COMMON | STATIC | SHARED] [VERBOSE]
  [C_FLAGS VAR] [CXX_FLAGS VAR] [GENRB_ARGS arg1 [arg2 ...]
  [PKGDATA_ARGS arg1 [arg2 ...]] [RESOURCE_LOCATION VAR] [REVISION rev]
  [IMPORT_DIRECTORY dir])

This function wraps the functionality provided by ICU's genrb and pkgdata tools. These tools allow to create a resource bundle from a set of text files. The module adds the executables as a custom command to the specified target. The name of the resource bundle is determined by the name argument, the input files by file1, file2, etc. Resource bundles can be created either as an endian-specific, but portable common data file, or as a static/shared library. Unless explicitly specified, a common data resource bundle will be created. When creating a static or shared resource bundle, an imported library target will be added which can be referenced by bundle's name. In some situations it may be necessary to specify additional genrb or pkgdata command-line arguments. This can be achieved by setting the optional GENRB_ARGS or PKGDATA_ARGS argument, respectively. The standard output of both tools is suppressed by default. To prevent this behavior, the VERBOSE option can be used. The location of the resource can be determined using the RESOURCE_LOCATION option together with a variable name VAR that will store that path. When creating a shared library bundle on Unix-like system, library's revision has to be set. This can be done by supplying the appropriate version to the REVISION option. If the option is omitted, the revision will be set to 1.0. The option IMPORT_DIRECTORY can be used to specify the directory that contains the resources which are imported by the resource bundle.