FindICU.cmake 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. # This module can find the International Components for Unicode (ICU) Library
  2. #
  3. # Requirements:
  4. # - CMake >= 2.8.3 (for new version of find_package_handle_standard_args)
  5. #
  6. # The following variables will be defined for your use:
  7. # - ICU_FOUND : were all of your specified components found (include dependencies)?
  8. # - ICU_INCLUDE_DIRS : ICU include directory
  9. # - ICU_LIBRARIES : ICU libraries
  10. # - ICU_VERSION : complete version of ICU (x.y.z)
  11. # - ICU_MAJOR_VERSION : major version of ICU
  12. # - ICU_MINOR_VERSION : minor version of ICU
  13. # - ICU_PATCH_VERSION : patch version of ICU
  14. # - ICU_<COMPONENT>_FOUND : were <COMPONENT> found? (FALSE for non specified component if it is not a dependency)
  15. #
  16. # For windows or non standard installation, define ICU_ROOT variable to point to the root installation of ICU. Two ways:
  17. # - run cmake with -DICU_ROOT=<PATH>
  18. # - define an environment variable with the same name before running cmake
  19. # With cmake-gui, before pressing "Configure":
  20. # 1) Press "Add Entry" button
  21. # 2) Add a new entry defined as:
  22. # - Name: ICU_ROOT
  23. # - Type: choose PATH in the selection list
  24. # - Press "..." button and select the root installation of ICU
  25. #
  26. # Example Usage:
  27. #
  28. # 1. Copy this file in the root of your project source directory
  29. # 2. Then, tell CMake to search this non-standard module in your project directory by adding to your CMakeLists.txt:
  30. # set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
  31. # 3. Finally call find_package() once, here are some examples to pick from
  32. #
  33. # Require ICU 4.4 or later
  34. # find_package(ICU 4.4 REQUIRED)
  35. #
  36. # if(ICU_FOUND)
  37. # include_directories(${ICU_INCLUDE_DIRS})
  38. # add_executable(myapp myapp.c)
  39. # target_link_libraries(myapp ${ICU_LIBRARIES})
  40. # endif(ICU_FOUND)
  41. #=============================================================================
  42. # Copyright (c) 2011-2013, julp
  43. #
  44. # Distributed under the OSI-approved BSD License
  45. #
  46. # This software is distributed WITHOUT ANY WARRANTY; without even the
  47. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  48. #=============================================================================
  49. ########## Private ##########
  50. if(NOT DEFINED ICU_PUBLIC_VAR_NS)
  51. set(ICU_PUBLIC_VAR_NS "ICU") # Prefix for all ICU relative public variables
  52. endif(NOT DEFINED ICU_PUBLIC_VAR_NS)
  53. if(NOT DEFINED ICU_PRIVATE_VAR_NS)
  54. set(ICU_PRIVATE_VAR_NS "_${ICU_PUBLIC_VAR_NS}") # Prefix for all ICU relative internal variables
  55. endif(NOT DEFINED ICU_PRIVATE_VAR_NS)
  56. if(NOT DEFINED PC_ICU_PRIVATE_VAR_NS)
  57. set(PC_ICU_PRIVATE_VAR_NS "_PC${ICU_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables
  58. endif(NOT DEFINED PC_ICU_PRIVATE_VAR_NS)
  59. function(icudebug _VARNAME)
  60. if(${ICU_PUBLIC_VAR_NS}_DEBUG)
  61. if(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
  62. message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = ${${ICU_PUBLIC_VAR_NS}_${_VARNAME}}")
  63. else(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
  64. message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = <UNDEFINED>")
  65. endif(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
  66. endif(${ICU_PUBLIC_VAR_NS}_DEBUG)
  67. endfunction(icudebug)
  68. set(${ICU_PRIVATE_VAR_NS}_ROOT "")
  69. if(DEFINED ENV{ICU_ROOT})
  70. set(${ICU_PRIVATE_VAR_NS}_ROOT "$ENV{ICU_ROOT}")
  71. endif(DEFINED ENV{ICU_ROOT})
  72. if (DEFINED ICU_ROOT)
  73. set(${ICU_PRIVATE_VAR_NS}_ROOT "${ICU_ROOT}")
  74. endif(DEFINED ICU_ROOT)
  75. set(${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES )
  76. set(${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES )
  77. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  78. list(APPEND ${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin64")
  79. list(APPEND ${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib64")
  80. endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
  81. list(APPEND ${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin")
  82. list(APPEND ${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib")
  83. set(${ICU_PRIVATE_VAR_NS}_COMPONENTS )
  84. # <icu component name> <library name 1> ... <library name N>
  85. macro(icu_declare_component _NAME)
  86. list(APPEND ${ICU_PRIVATE_VAR_NS}_COMPONENTS ${_NAME})
  87. set("${ICU_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN})
  88. endmacro(icu_declare_component)
  89. icu_declare_component(data icudata)
  90. icu_declare_component(uc icuuc) # Common and Data libraries
  91. icu_declare_component(i18n icui18n icuin) # Internationalization library
  92. icu_declare_component(io icuio ustdio) # Stream and I/O Library
  93. icu_declare_component(le icule) # Layout library
  94. icu_declare_component(lx iculx) # Paragraph Layout library
  95. ########## Public ##########
  96. set(${ICU_PUBLIC_VAR_NS}_FOUND TRUE)
  97. set(${ICU_PUBLIC_VAR_NS}_LIBRARIES )
  98. set(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS )
  99. set(${ICU_PUBLIC_VAR_NS}_C_FLAGS "")
  100. set(${ICU_PUBLIC_VAR_NS}_CXX_FLAGS "")
  101. set(${ICU_PUBLIC_VAR_NS}_CPP_FLAGS "")
  102. set(${ICU_PUBLIC_VAR_NS}_C_SHARED_FLAGS "")
  103. set(${ICU_PUBLIC_VAR_NS}_CXX_SHARED_FLAGS "")
  104. set(${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS "")
  105. foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PRIVATE_VAR_NS}_COMPONENTS})
  106. string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT)
  107. set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the icu_declare_component macro
  108. endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
  109. # Check components
  110. if(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) # uc required at least
  111. set(${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc)
  112. else(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
  113. list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc)
  114. list(REMOVE_DUPLICATES ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
  115. foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
  116. if(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
  117. message(FATAL_ERROR "Unknown ICU component: ${${ICU_PRIVATE_VAR_NS}_COMPONENT}")
  118. endif(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
  119. endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
  120. endif(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
  121. # Includes
  122. find_path(
  123. ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
  124. NAMES unicode/utypes.h utypes.h
  125. HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
  126. PATH_SUFFIXES "include"
  127. DOC "Include directories for ICU"
  128. )
  129. if(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
  130. ########## <part to keep synced with tests/version/CMakeLists.txt> ##########
  131. if(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uvernum.h") # ICU >= 4
  132. file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uvernum.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
  133. elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uversion.h") # ICU [2;4[
  134. file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uversion.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
  135. elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/utypes.h") # ICU [1.4;2[
  136. file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/utypes.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
  137. elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h") # ICU 1.3
  138. file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
  139. else()
  140. message(FATAL_ERROR "ICU version header not found")
  141. endif()
  142. if(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *ICU_VERSION *\"([0-9]+)\".*") # ICU 1.3
  143. # [1.3;1.4[ as #define ICU_VERSION "3" (no patch version, ie all 1.3.X versions will be detected as 1.3.0)
  144. set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "1")
  145. set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_1}")
  146. set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "0")
  147. elseif(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *U_ICU_VERSION_MAJOR_NUM *([0-9]+).*")
  148. #
  149. # Since version 4.9.1, ICU release version numbering was totaly changed, see:
  150. # - http://site.icu-project.org/download/49
  151. # - http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
  152. #
  153. set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
  154. string(REGEX REPLACE ".*# *define *U_ICU_VERSION_MINOR_NUM *([0-9]+).*" "\\1" ${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS}")
  155. string(REGEX REPLACE ".*# *define *U_ICU_VERSION_PATCHLEVEL_NUM *([0-9]+).*" "\\1" ${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "${${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS}")
  156. elseif(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *U_ICU_VERSION *\"(([0-9]+)(\\.[0-9]+)*)\".*") # ICU [1.4;1.8[
  157. # [1.4;1.8[ as #define U_ICU_VERSION "1.4.1.2" but it seems that some 1.4.1(?:\.\d)? have releasing error and appears as 1.4.0
  158. set(${ICU_PRIVATE_VAR_NS}_FULL_VERSION "${CMAKE_MATCH_1}") # copy CMAKE_MATCH_1, no longer valid on the following if
  159. if(${ICU_PRIVATE_VAR_NS}_FULL_VERSION MATCHES "^([0-9]+)\\.([0-9]+)$")
  160. set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
  161. set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}")
  162. set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "0")
  163. elseif(${ICU_PRIVATE_VAR_NS}_FULL_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
  164. set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
  165. set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}")
  166. set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "${CMAKE_MATCH_3}")
  167. endif()
  168. else()
  169. message(FATAL_ERROR "failed to detect ICU version")
  170. endif()
  171. set(${ICU_PUBLIC_VAR_NS}_VERSION "${${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_MINOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_PATCH_VERSION}")
  172. ########## </part to keep synced with tests/version/CMakeLists.txt> ##########
  173. # Check dependencies (implies pkg-config)
  174. if(PKG_CONFIG_FOUND)
  175. set(${ICU_PRIVATE_VAR_NS}_COMPONENTS_DUP ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
  176. foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PRIVATE_VAR_NS}_COMPONENTS_DUP})
  177. pkg_check_modules(PC_ICU_PRIVATE_VAR_NS "icu-${${ICU_PRIVATE_VAR_NS}_COMPONENT}" QUIET)
  178. if(${PC_ICU_PRIVATE_VAR_NS}_FOUND)
  179. foreach(${PC_ICU_PRIVATE_VAR_NS}_LIBRARY ${PC_ICU_LIBRARIES})
  180. string(REGEX REPLACE "^icu" "" ${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY ${${PC_ICU_PRIVATE_VAR_NS}_LIBRARY})
  181. list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS ${${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY})
  182. endforeach(${PC_ICU_PRIVATE_VAR_NS}_LIBRARY)
  183. endif(${PC_ICU_PRIVATE_VAR_NS}_FOUND)
  184. endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
  185. list(REMOVE_DUPLICATES ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
  186. endif(PKG_CONFIG_FOUND)
  187. # Check libraries
  188. foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
  189. set(${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES )
  190. set(${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES )
  191. foreach(${ICU_PRIVATE_VAR_NS}_BASE_NAME ${${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT}})
  192. list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}")
  193. list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}d")
  194. list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${ICU_MAJOR_VERSION}${ICU_MINOR_VERSION}")
  195. list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${ICU_MAJOR_VERSION}${ICU_MINOR_VERSION}d")
  196. endforeach(${ICU_PRIVATE_VAR_NS}_BASE_NAME)
  197. find_library(
  198. ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
  199. NAMES ${${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES}
  200. HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
  201. PATH_SUFFIXES ${_ICU_LIB_SUFFIXES}
  202. DOC "Release libraries for ICU"
  203. )
  204. find_library(
  205. ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
  206. NAMES ${${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES}
  207. HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
  208. PATH_SUFFIXES ${_ICU_LIB_SUFFIXES}
  209. DOC "Debug libraries for ICU"
  210. )
  211. string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT)
  212. if(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # both not found
  213. set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE)
  214. set("${ICU_PUBLIC_VAR_NS}_FOUND" FALSE)
  215. else(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # one or both found
  216. set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE)
  217. if(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # release not found => we are in debug
  218. set(${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT} "${${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}")
  219. elseif(NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # debug not found => we are in release
  220. set(${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT} "${${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}")
  221. else() # both found
  222. set(
  223. ${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
  224. optimized ${${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}
  225. debug ${${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}
  226. )
  227. endif()
  228. list(APPEND ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT}})
  229. endif(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
  230. endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
  231. # Try to find out compiler flags
  232. find_program(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE icu-config HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT})
  233. if(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE)
  234. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_C_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  235. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cxxflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  236. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cppflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CPP_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  237. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_C_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  238. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cxxflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CXX_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  239. execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cppflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
  240. endif(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE)
  241. # Check find_package arguments
  242. include(FindPackageHandleStandardArgs)
  243. if(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
  244. find_package_handle_standard_args(
  245. ${ICU_PUBLIC_VAR_NS}
  246. REQUIRED_VARS ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
  247. VERSION_VAR ${ICU_PUBLIC_VAR_NS}_VERSION
  248. )
  249. else(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
  250. find_package_handle_standard_args(${ICU_PUBLIC_VAR_NS} "ICU not found" ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
  251. endif(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
  252. else(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
  253. if(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
  254. message(FATAL_ERROR "Could not find ICU include directory")
  255. endif(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
  256. endif(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
  257. mark_as_advanced(
  258. ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
  259. ${ICU_PUBLIC_VAR_NS}_LIBRARIES
  260. )
  261. # IN (args)
  262. icudebug("FIND_COMPONENTS")
  263. icudebug("FIND_REQUIRED")
  264. icudebug("FIND_QUIETLY")
  265. icudebug("FIND_VERSION")
  266. # OUT
  267. # Found
  268. icudebug("FOUND")
  269. icudebug("UC_FOUND")
  270. icudebug("I18N_FOUND")
  271. icudebug("IO_FOUND")
  272. icudebug("LE_FOUND")
  273. icudebug("LX_FOUND")
  274. icudebug("DATA_FOUND")
  275. # Flags
  276. icudebug("C_FLAGS")
  277. icudebug("CPP_FLAGS")
  278. icudebug("CXX_FLAGS")
  279. icudebug("C_SHARED_FLAGS")
  280. icudebug("CPP_SHARED_FLAGS")
  281. icudebug("CXX_SHARED_FLAGS")
  282. # Linking
  283. icudebug("INCLUDE_DIRS")
  284. icudebug("LIBRARIES")
  285. # Version
  286. icudebug("MAJOR_VERSION")
  287. icudebug("MINOR_VERSION")
  288. icudebug("PATCH_VERSION")
  289. icudebug("VERSION")