FindICU.cmake 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # - Try to find the ICU unicode library
  17. # Once done this will define
  18. #
  19. # ICU_FOUND - system has the ICU library
  20. # ICU_INCLUDE_DIR - the ICU include directory
  21. # ICU_LIBRARIES - The libraries needed to use ICU
  22. IF (NOT ICU_FOUND)
  23. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  24. IF (UNIX)
  25. IF (${ARCH64BIT} EQUAL 1)
  26. SET (osdir "linux64_gcc4.1.1")
  27. ELSE()
  28. SET (osdir "linux32_gcc4.1.1")
  29. ENDIF()
  30. ELSEIF(WIN32)
  31. SET (osdir )
  32. ELSE()
  33. SET (osdir "unknown")
  34. ENDIF()
  35. IF (NOT ("${osdir}" STREQUAL "unknown"))
  36. FIND_PATH (ICU_INCLUDE_DIR NAMES unicode/uchar.h PATHS "${EXTERNALS_DIRECTORY}/icu/include" NO_DEFAULT_PATH)
  37. FIND_LIBRARY (ICU_LIBRARIES NAMES icuuc PATHS "${EXTERNALS_DIRECTORY}/icu/lib/${osdir}" NO_DEFAULT_PATH)
  38. ENDIF()
  39. ENDIF()
  40. if (USE_NATIVE_LIBRARIES)
  41. # if we didn't find in externals, look in system include path
  42. FIND_PATH (ICU_INCLUDE_DIR NAMES unicode/uchar.h)
  43. FIND_LIBRARY (ICU_LIBRARIES NAMES icuuc)
  44. endif()
  45. include(FindPackageHandleStandardArgs)
  46. find_package_handle_standard_args(ICU DEFAULT_MSG
  47. ICU_LIBRARIES
  48. ICU_INCLUDE_DIR
  49. )
  50. IF (ICU_FOUND)
  51. IF (UNIX)
  52. STRING(REPLACE "icuuc" "icui18n" ICU_EXTRA1 "${ICU_LIBRARIES}")
  53. STRING(REPLACE "icuuc" "icudata" ICU_EXTRA2 "${ICU_LIBRARIES}")
  54. ELSE()
  55. STRING(REPLACE "icuuc" "icuin" ICU_EXTRA1 "${ICU_LIBRARIES}")
  56. ENDIF()
  57. set (ICU_LIBRARIES ${ICU_LIBRARIES} ${ICU_EXTRA1} ${ICU_EXTRA2} )
  58. ENDIF()
  59. MARK_AS_ADVANCED(ICU_INCLUDE_DIR ICU_LIBRARIES)
  60. ENDIF()