FindIntl.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #
  7. # Find the Gettext libintl headers and libraries.
  8. #
  9. # This module reports information about the Gettext libintl
  10. # installation in several variables. General variables::
  11. #
  12. # Intl_FOUND - true if the libintl headers and libraries were found
  13. # Intl_INCLUDE_DIRS - the directory containing the libintl headers
  14. # Intl_LIBRARIES - libintl libraries to be linked
  15. #
  16. # The following cache variables may also be set::
  17. #
  18. # Intl_INCLUDE_DIR - the directory containing the libintl headers
  19. # Intl_LIBRARY - the libintl library (if any)
  20. #
  21. # .. note::
  22. # On some platforms, such as Linux with GNU libc, the gettext
  23. # functions are present in the C standard library and libintl
  24. # is not required. ``Intl_LIBRARIES`` will be empty in this
  25. # case.
  26. #
  27. # .. note::
  28. # If you wish to use the Gettext tools (``msgmerge``,
  29. # ``msgfmt``, etc.), use :module:`FindGettext`.
  30. # Written by Roger Leigh <rleigh@codelibre.net>
  31. # Find include directory
  32. find_path(Intl_INCLUDE_DIR
  33. NAMES "libintl.h"
  34. DOC "libintl include directory")
  35. mark_as_advanced(Intl_INCLUDE_DIR)
  36. # Find all Intl libraries
  37. find_library(Intl_LIBRARY "intl"
  38. DOC "libintl libraries (if not in the C library)")
  39. mark_as_advanced(Intl_LIBRARY)
  40. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  41. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl
  42. FOUND_VAR Intl_FOUND
  43. REQUIRED_VARS Intl_INCLUDE_DIR
  44. FAIL_MESSAGE "Failed to find Gettext libintl")
  45. if(Intl_FOUND)
  46. set(Intl_INCLUDE_DIRS "${Intl_INCLUDE_DIR}")
  47. if(Intl_LIBRARY)
  48. set(Intl_LIBRARIES "${Intl_LIBRARY}")
  49. else()
  50. unset(Intl_LIBRARIES)
  51. endif()
  52. endif()