Home

Awesome

FindICU.cmake

A CMake module to find International Components for Unicode (ICU) Library

Note that CMake, since its version 3.7.0, includes a FindICU module that does NOT work in the same way at all (they are not compatible). Make sure, if you use the present module, to include it and give it the priority by redefining CMAKE_MODULE_PATH accordingly.

Information

Prerequisites

Only one:

License

License: BSD-2 clause

Usage

Variables set for your project

Note: all ICU_*_FLAGS variables will be defined as empty strings if icu-config does not exist or cannot be found

Functions

Create resource bundles

icu_generate_resource_bundle(
    NAME <name>
    FILES <list of files>
    [ FORMAT <name> ]
    [ PACKAGE ] [ TYPE <name> ] [ DEPENDS <list of dependencies> ] [ NO_SHARED_FLAGS ]
    [ DESTINATION <location> ]
)

See tests/RB/c_*pkg* for examples.

How to use

For developpers

Notes:

For end users

If ICU is located in a non-regular place, add a -DICU_ROOT_DIR=<PATH> option to your cmake command line.

Sample

For a binary which implies ICU >= 4.4:

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
find_package(ICU 4.4 COMPONENTS io i18n REQUIRED)

include_directories(${ICU_INCLUDE_DIRS})

add_executable(tables tables.c)
target_link_libraries(tables ${ICU_LIBRARIES})

For CMake >= 3.0.0, you can also use an imported target. The same example becomes:

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
find_package(ICU 4.4 COMPONENTS io i18n REQUIRED)

add_executable(tables tables.c)
target_link_libraries(tables ICU::ICU)