Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

FindPCRE.cmake 3.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
  1. #
  2. # $Id$
  3. #
  4. # Locate pcre
  5. #
  6. # This module accepts the following environment variables:
  7. #
  8. # PCRE_DIR or PCRE_ROOT - Specify the location of PCRE
  9. #
  10. # This module defines the following CMake variables:
  11. #
  12. # PCRE_FOUND - True if libpcre is found
  13. # PCRE_LIBRARY - A variable pointing to the PCRE library
  14. # PCRE_INCLUDE_DIR - Where to find the headers
  15. #=============================================================================
  16. # Inspired by FindGDAL
  17. #
  18. # Distributed under the OSI-approved BSD License (the "License");
  19. # see accompanying file Copyright.txt for details.
  20. #
  21. # This software is distributed WITHOUT ANY WARRANTY; without even the
  22. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. # See COPYING-CMAKE-SCRIPTS for more information.
  24. #=============================================================================
  25. # This makes the presumption that you are include pcre.h like
  26. #
  27. #include "pcre.h"
  28. if (DEFINED PCRE_ROOT AND NOT PCRE_ROOT)
  29. set (PCRE_LIBRARY "" CACHE INTERNAL "")
  30. set (PCRE_INCLUDE_DIR "" CACHE INTERNAL "")
  31. return ()
  32. endif (DEFINED PCRE_ROOT AND NOT PCRE_ROOT)
  33. if (UNIX AND NOT PCRE_FOUND)
  34. # Use pcre-config to obtain the library version (this should hopefully
  35. # allow us to -lpcre1.x.y where x.y are correct version)
  36. # For some reason, libpcre development packages do not contain
  37. # libpcre.so...
  38. find_program (PCRE_CONFIG pcre-config
  39. HINTS
  40. ${PCRE_DIR}
  41. ${PCRE_ROOT}
  42. $ENV{PCRE_DIR}
  43. $ENV{PCRE_ROOT}
  44. PATH_SUFFIXES bin
  45. PATHS
  46. /sw # Fink
  47. /opt/local # DarwinPorts
  48. /opt/csw # Blastwave
  49. /opt
  50. /usr/local
  51. )
  52. if (PCRE_CONFIG)
  53. execute_process (COMMAND ${PCRE_CONFIG} --cflags
  54. ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
  55. OUTPUT_VARIABLE PCRE_CONFIG_CFLAGS)
  56. if (PCRE_CONFIG_CFLAGS)
  57. string (REGEX MATCHALL "-I[^ ]+" _pcre_dashI ${PCRE_CONFIG_CFLAGS})
  58. string (REGEX REPLACE "-I" "" _pcre_includepath "${_pcre_dashI}")
  59. string (REGEX REPLACE "-I[^ ]+" "" _pcre_cflags_other ${PCRE_CONFIG_CFLAGS})
  60. endif (PCRE_CONFIG_CFLAGS)
  61. execute_process (COMMAND ${PCRE_CONFIG} --libs
  62. ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
  63. OUTPUT_VARIABLE PCRE_CONFIG_LIBS)
  64. if (PCRE_CONFIG_LIBS)
  65. string (REGEX MATCHALL "-l[^ ]+" _pcre_dashl ${PCRE_CONFIG_LIBS})
  66. string (REGEX REPLACE "-l" "" _pcre_lib "${_pcre_dashl}")
  67. string (REGEX MATCHALL "-L[^ ]+" _pcre_dashL ${PCRE_CONFIG_LIBS})
  68. string (REGEX REPLACE "-L" "" _pcre_libpath "${_pcre_dashL}")
  69. endif (PCRE_CONFIG_LIBS)
  70. endif (PCRE_CONFIG)
  71. endif (UNIX AND NOT PCRE_FOUND)
  72. find_path (PCRE_INCLUDE_DIR pcre.h
  73. HINTS
  74. ${_pcre_includepath}
  75. ${PCRE_DIR}
  76. ${PCRE_ROOT}
  77. $ENV{PCRE_DIR}
  78. $ENV{PCRE_ROOT}
  79. PATH_SUFFIXES
  80. include/pcre
  81. include/PCRE
  82. include
  83. PATHS
  84. ~/Library/Frameworks/pcre.framework/Headers
  85. /Library/Frameworks/pcre.framework/Headers
  86. /sw # Fink
  87. /opt/local # DarwinPorts
  88. /opt/csw # Blastwave
  89. /opt
  90. /usr/local
  91. )
  92. find_library (PCRE_LIBRARY
  93. NAMES ${_pcre_lib} pcre pcre.0 PCRE
  94. HINTS
  95. ${PCRE_DIR}
  96. ${PCRE_ROOT}
  97. $ENV{PCRE_DIR}
  98. $ENV{PCRE_ROOT}
  99. ${_pcre_libpath}
  100. PATH_SUFFIXES lib
  101. PATHS
  102. ~/Library/Frameworks/pcre.framework
  103. /Library/Frameworks/pcre.framework
  104. /sw
  105. /opt/local
  106. /opt/csw
  107. /opt
  108. /usr/local
  109. )
  110. include (FindPackageHandleStandardArgs)
  111. find_package_handle_standard_args (PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
  112. set (PCRE_LIBRARIES ${PCRE_LIBRARY})
  113. set (PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
  114. # vim: textwidth=78 noexpandtab tabstop=2 softtabstop=2 shiftwidth=2
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...