FindPCRE.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # - Find PCRE library
  2. # Find the native PCRE includes and library
  3. # This module defines
  4. # PCRE_INCLUDE_DIRS, where to find pcre.h, Set when
  5. # PCRE_INCLUDE_DIR is found.
  6. # PCRE_LIBRARIES, libraries to link against to use PCRE.
  7. # PCRE_ROOT_DIR, The base directory to search for PCRE.
  8. # This can also be an environment variable.
  9. # PCRE_FOUND, If false, do not try to use PCRE.
  10. #
  11. # also defined, but not for general use are
  12. # PCRE_LIBRARY, where to find the PCRE library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If PCRE_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT PCRE_ROOT_DIR AND NOT $ENV{PCRE_ROOT_DIR} STREQUAL "")
  25. SET(PCRE_ROOT_DIR $ENV{PCRE_ROOT_DIR})
  26. ENDIF()
  27. SET(_pcre_SEARCH_DIRS
  28. ${PCRE_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/csw # Blastwave
  33. )
  34. FIND_PATH(PCRE_INCLUDE_DIR pcre.h
  35. HINTS
  36. ${_pcre_SEARCH_DIRS}
  37. PATH_SUFFIXES
  38. include
  39. )
  40. FIND_LIBRARY(PCRE_LIBRARY
  41. NAMES
  42. pcre
  43. HINTS
  44. ${_pcre_SEARCH_DIRS}
  45. PATH_SUFFIXES
  46. lib64 lib
  47. )
  48. # handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
  49. # all listed variables are TRUE
  50. INCLUDE(FindPackageHandleStandardArgs)
  51. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
  52. PCRE_LIBRARY PCRE_INCLUDE_DIR)
  53. IF(PCRE_FOUND)
  54. SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
  55. SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
  56. ENDIF(PCRE_FOUND)
  57. MARK_AS_ADVANCED(
  58. PCRE_INCLUDE_DIR
  59. PCRE_LIBRARY
  60. )