FindIcuLinux.cmake 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # - Find static icu libraries
  2. # Find the native static icu libraries (needed for static boost_locale :/ ).
  3. # This module defines
  4. # ICU_LIBRARIES, libraries to link against to use icu.
  5. # ICU_ROOT_DIR, The base directory to search for icu.
  6. # This can also be an environment variable.
  7. # ICU_FOUND, If false, do not try to use icu.
  8. #
  9. # also defined, but not for general use are
  10. # ICU_LIBRARY_xxx, where to find the icu libraries.
  11. #=============================================================================
  12. # Copyright 2012 Blender Foundation.
  13. #
  14. # Distributed under the OSI-approved BSD License (the "License");
  15. # see accompanying file Copyright.txt for details.
  16. #
  17. # This software is distributed WITHOUT ANY WARRANTY; without even the
  18. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  19. # See the License for more information.
  20. #=============================================================================
  21. # If ICU_ROOT_DIR was defined in the environment, use it.
  22. IF(NOT ICU_ROOT_DIR AND NOT $ENV{ICU_ROOT_DIR} STREQUAL "")
  23. SET(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
  24. ENDIF()
  25. if(Boost_USE_STATIC_LIBS)
  26. set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
  27. set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
  28. endif()
  29. SET(_icu_SEARCH_DIRS
  30. ${ICU_ROOT_DIR}
  31. /usr/local
  32. /sw # Fink
  33. /opt/local # DarwinPorts
  34. /opt/csw # Blastwave
  35. )
  36. # We don't need includes, only libs to link against...
  37. #FIND_PATH(ICU_INCLUDE_DIR
  38. # NAMES
  39. # utf.h
  40. # HINTS
  41. # ${_icu_SEARCH_DIRS}
  42. # PATH_SUFFIXES
  43. # include/unicode
  44. #)
  45. FIND_LIBRARY(ICU_LIBRARY_DATA
  46. NAMES
  47. icudata
  48. HINTS
  49. ${_icu_SEARCH_DIRS}
  50. PATH_SUFFIXES
  51. lib64 lib
  52. )
  53. FIND_LIBRARY(ICU_LIBRARY_I18N
  54. NAMES
  55. icui18n
  56. HINTS
  57. ${_icu_SEARCH_DIRS}
  58. PATH_SUFFIXES
  59. lib64 lib
  60. )
  61. FIND_LIBRARY(ICU_LIBRARY_IO
  62. NAMES
  63. icuio
  64. HINTS
  65. ${_icu_SEARCH_DIRS}
  66. PATH_SUFFIXES
  67. lib64 lib
  68. )
  69. FIND_LIBRARY(ICU_LIBRARY_LE
  70. NAMES
  71. icule
  72. HINTS
  73. ${_icu_SEARCH_DIRS}
  74. PATH_SUFFIXES
  75. lib64 lib
  76. )
  77. FIND_LIBRARY(ICU_LIBRARY_LX
  78. NAMES
  79. iculx
  80. HINTS
  81. ${_icu_SEARCH_DIRS}
  82. PATH_SUFFIXES
  83. lib64 lib
  84. )
  85. FIND_LIBRARY(ICU_LIBRARY_TU
  86. NAMES
  87. icutu
  88. HINTS
  89. ${_icu_SEARCH_DIRS}
  90. PATH_SUFFIXES
  91. lib64 lib
  92. )
  93. FIND_LIBRARY(ICU_LIBRARY_UC
  94. NAMES
  95. icuuc
  96. HINTS
  97. ${_icu_SEARCH_DIRS}
  98. PATH_SUFFIXES
  99. lib64 lib
  100. )
  101. # Restore the original find library ordering
  102. if(Boost_USE_STATIC_LIBS)
  103. set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
  104. endif()
  105. # handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
  106. # all listed variables are TRUE
  107. INCLUDE(FindPackageHandleStandardArgs)
  108. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
  109. ICU_LIBRARY_DATA
  110. ICU_LIBRARY_I18N
  111. ICU_LIBRARY_IO
  112. ICU_LIBRARY_LE
  113. ICU_LIBRARY_LX
  114. ICU_LIBRARY_TU
  115. ICU_LIBRARY_UC
  116. )
  117. IF(ICU_FOUND)
  118. SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
  119. SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
  120. ENDIF(ICU_FOUND)
  121. MARK_AS_ADVANCED(
  122. ICU_INCLUDE_DIR
  123. ICU_LIBRARY_DATA
  124. ICU_LIBRARY_I18N
  125. ICU_LIBRARY_IO
  126. ICU_LIBRARY_LE
  127. ICU_LIBRARY_LX
  128. ICU_LIBRARY_TU
  129. ICU_LIBRARY_UC
  130. )