FindIntl.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindIntl
  5. --------
  6. Find the Gettext libintl headers and libraries.
  7. This module reports information about the Gettext libintl
  8. installation in several variables. General variables::
  9. Intl_FOUND - true if the libintl headers and libraries were found
  10. Intl_INCLUDE_DIRS - the directory containing the libintl headers
  11. Intl_LIBRARIES - libintl libraries to be linked
  12. The following cache variables may also be set::
  13. Intl_INCLUDE_DIR - the directory containing the libintl headers
  14. Intl_LIBRARY - the libintl library (if any)
  15. .. note::
  16. On some platforms, such as Linux with GNU libc, the gettext
  17. functions are present in the C standard library and libintl
  18. is not required. ``Intl_LIBRARIES`` will be empty in this
  19. case.
  20. .. note::
  21. If you wish to use the Gettext tools (``msgmerge``,
  22. ``msgfmt``, etc.), use :module:`FindGettext`.
  23. #]=======================================================================]
  24. # Written by Roger Leigh <rleigh@codelibre.net>
  25. # Find include directory
  26. find_path(Intl_INCLUDE_DIR
  27. NAMES "libintl.h"
  28. DOC "libintl include directory")
  29. mark_as_advanced(Intl_INCLUDE_DIR)
  30. # Find all Intl libraries
  31. find_library(Intl_LIBRARY "intl"
  32. DOC "libintl libraries (if not in the C library)")
  33. mark_as_advanced(Intl_LIBRARY)
  34. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  35. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
  36. FOUND_VAR Intl_FOUND
  37. REQUIRED_VARS Intl_INCLUDE_DIR
  38. FAIL_MESSAGE "Failed to find Gettext libintl")
  39. if(Intl_FOUND)
  40. set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
  41. if(Intl_LIBRARY)
  42. set(Intl_LIBRARIES "${Intl_LIBRARY}")
  43. else()
  44. unset(Intl_LIBRARIES)
  45. endif()
  46. endif()