FindIntl.cmake 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #.rst:
  2. # FindIntl
  3. # --------
  4. #
  5. # Find the Gettext libintl headers and libraries.
  6. #
  7. # This module reports information about the Gettext libintl
  8. # installation in several variables. General variables::
  9. #
  10. # Intl_FOUND - true if the libintl headers and libraries were found
  11. # Intl_INCLUDE_DIRS - the directory containing the libintl headers
  12. # Intl_LIBRARIES - libintl libraries to be linked
  13. #
  14. # The following cache variables may also be set::
  15. #
  16. # Intl_INCLUDE_DIR - the directory containing the libintl headers
  17. # Intl_LIBRARY - the libintl library (if any)
  18. #
  19. # .. note::
  20. # On some platforms, such as Linux with GNU libc, the gettext
  21. # functions are present in the C standard library and libintl
  22. # is not required. ``Intl_LIBRARIES`` will be empty in this
  23. # case.
  24. #
  25. # .. note::
  26. # If you wish to use the Gettext tools (``msgmerge``,
  27. # ``msgfmt``, etc.), use :module:`FindGettext`.
  28. # Written by Roger Leigh <rleigh@codelibre.net>
  29. #=============================================================================
  30. # Copyright 2014 Roger Leigh <rleigh@codelibre.net>
  31. #
  32. # Distributed under the OSI-approved BSD License (the "License");
  33. # see accompanying file Copyright.txt for details.
  34. #
  35. # This software is distributed WITHOUT ANY WARRANTY; without even the
  36. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  37. # See the License for more information.
  38. #=============================================================================
  39. # (To distribute this file outside of CMake, substitute the full
  40. # License text for the above reference.)
  41. # Find include directory
  42. find_path(Intl_INCLUDE_DIR
  43. NAMES "libintl.h"
  44. DOC "libintl include directory")
  45. mark_as_advanced(Intl_INCLUDE_DIR)
  46. # Find all Intl libraries
  47. find_library(Intl_LIBRARY "intl"
  48. DOC "libintl libraries (if not in the C library)")
  49. mark_as_advanced(Intl_LIBRARY)
  50. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
  52. FOUND_VAR Intl_FOUND
  53. REQUIRED_VARS Intl_INCLUDE_DIR
  54. FAIL_MESSAGE "Failed to find Gettext libintl")
  55. if(Intl_FOUND)
  56. set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
  57. if(Intl_LIBRARY)
  58. set(Intl_LIBRARIES "${Intl_LIBRARY}")
  59. else()
  60. unset(Intl_LIBRARIES)
  61. endif()
  62. endif()