1 # Finds the International Components for Unicode (ICU) Library
3 # ICU_FOUND - True if ICU found.
4 # ICU_I18N_FOUND - True if ICU's internationalization library found.
5 # ICU_INCLUDE_DIRS - Directory to include to get ICU headers
6 # Note: always include ICU headers as, e.g.,
8 # ICU_LIBRARIES - Libraries to link against for the common ICU
9 # ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
10 # (note: in addition to ICU_LIBRARIES)
12 # Look for the header file.
15 NAMES unicode/utypes.h
16 DOC "Include directory for the ICU library")
17 MARK_AS_ADVANCED(ICU_INCLUDE_DIR)
19 # Look for the library.
22 NAMES icuuc cygicuuc cygicuuc32
23 DOC "Libraries to link against for the common parts of ICU")
24 MARK_AS_ADVANCED(ICU_LIBRARY)
26 # Copy the results to the output variables.
27 IF (ICU_INCLUDE_DIR AND ICU_LIBRARY)
29 SET(ICU_LIBRARIES ${ICU_LIBRARY})
30 SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
33 SET(ICU_MAJOR_VERSION 0)
34 SET(ICU_MINOR_VERSION 0)
35 FILE(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" _ICU_VERSION_CONENTS)
36 STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MAJOR_NUM ([0-9]+).*" "\\1" ICU_MAJOR_VERSION "${_ICU_VERSION_CONENTS}")
37 STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MINOR_NUM ([0-9]+).*" "\\1" ICU_MINOR_VERSION "${_ICU_VERSION_CONENTS}")
39 SET(ICU_VERSION "${ICU_MAJOR_VERSION}.${ICU_MINOR_VERSION}")
41 # Look for the ICU internationalization libraries
44 NAMES icuin icui18n cygicuin cygicuin32
45 DOC "Libraries to link against for ICU internationalization")
46 MARK_AS_ADVANCED(ICU_I18N_LIBRARY)
49 SET(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
52 SET(ICU_I18N_LIBRARIES)
58 SET(ICU_I18N_LIBRARIES)
61 SET(ICU_MAJOR_VERSION)
62 SET(ICU_MINOR_VERSION)
66 IF (NOT ICU_FIND_QUIETLY)
67 MESSAGE(STATUS "Found ICU header files in ${ICU_INCLUDE_DIRS}")
68 MESSAGE(STATUS "Found ICU libraries: ${ICU_LIBRARIES}")
71 IF (ICU_FIND_REQUIRED)
72 MESSAGE(FATAL_ERROR "Could not find ICU")
74 MESSAGE(STATUS "Optional package ICU was not found")