Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / cmake_modules / FindICU.cmake
blob9dff9f398e93abff9dae052485c42a21dfa7ae65
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., 
7 #                       unicode/utypes.h
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.
13 find_path(
14   ICU_INCLUDE_DIR 
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.
20 find_library(
21   ICU_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)
28   set(ICU_FOUND 1)
29   set(ICU_LIBRARIES ${ICU_LIBRARY})
30   set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
32   # Look for the ICU internationalization libraries
33   find_library(
34     ICU_I18N_LIBRARY
35     NAMES icuin icui18n cygicuin cygicuin32
36     DOC "Libraries to link against for ICU internationalization")
37   mark_as_advanced(ICU_I18N_LIBRARY)
38   if (ICU_I18N_LIBRARY)
39     set(ICU_I18N_FOUND 1)
40     set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
41   else (ICU_I18N_LIBRARY)
42     set(ICU_I18N_FOUND 0)
43     set(ICU_I18N_LIBRARIES)
44   endif (ICU_I18N_LIBRARY)
45 else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
46   set(ICU_FOUND 0)
47   set(ICU_I18N_FOUND 0)
48   set(ICU_LIBRARIES)
49   set(ICU_I18N_LIBRARIES)
50   set(ICU_INCLUDE_DIRS)
51 endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)