1 |
# CMakeLists.txt
|
2 |
#
|
3 |
#
|
4 |
# This file allows building PCRE with the CMake configuration and build
|
5 |
# tool. Download CMake in source or binary form from http://www.cmake.org/
|
6 |
#
|
7 |
# Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
|
8 |
# Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG>
|
9 |
# 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered
|
10 |
# 2007-09-19 Adjusted by PH to retain previous default settings
|
11 |
# 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre
|
12 |
# (b) Ensure pcretest and pcregrep link with the local library,
|
13 |
# not a previously-installed one.
|
14 |
# (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and
|
15 |
# PCRE_SUPPORT_LIBBZ2.
|
16 |
# 2008-01-20 Brought up to date to include several new features by Christian
|
17 |
# Ehrlicher.
|
18 |
# 2008-01-22 Sheri added options for backward compatibility of library names
|
19 |
# when building with minGW:
|
20 |
# if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to
|
21 |
# be built without "lib" as prefix. (The libraries will be named
|
22 |
# pcre.dll, pcreposix.dll and pcrecpp.dll).
|
23 |
# if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to
|
24 |
# be built with suffix of "-0.dll". (The libraries will be named
|
25 |
# libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names
|
26 |
# built by default with Configure and Make.
|
27 |
# 2008-01-23 PH removed the automatic build of pcredemo.
|
28 |
# 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
|
29 |
# 2008-07-03 PH updated for revised UCP property support (change of files)
|
30 |
# 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name
|
31 |
# CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
|
32 |
# is included within another project.
|
33 |
# 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to
|
34 |
# add options to stop the building of pcregrep and the tests, and
|
35 |
# to disable the final configuration report.
|
36 |
# 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
|
37 |
# are set by specifying a release type.
|
38 |
# 2010-01-02 PH added test for stdint.h
|
39 |
# 2010-03-02 PH added test for inttypes.h
|
40 |
# 2011-08-01 PH added PCREGREP_BUFSIZE
|
41 |
# 2011-08-22 PH added PCRE_SUPPORT_JIT
|
42 |
# 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov
|
43 |
# 2011-09-06 PH added PCRE_SUPPORT_PCREGREP_JIT
|
44 |
# 2011-10-04 Sheri added support for including coff data in windows shared libraries
|
45 |
# compiled with MINGW if pcre.rc and/or pcreposix.rc are placed in
|
46 |
# the source dir by the user prior to building
|
47 |
# 2011-10-04 Sheri changed various add_test's to use exes' location built instead
|
48 |
# of DEBUG location only (likely only matters in MSVC)
|
49 |
# 2011-10-04 Sheri added scripts to provide needed variables to RunTest and
|
50 |
# RunGrepTest (used for UNIX and Msys)
|
51 |
# 2011-10-04 Sheri added scripts to provide needed variables and to execute
|
52 |
# RunTest.bat in Win32 (for effortless testing with "make test")
|
53 |
# 2011-10-04 Sheri Increased minimum required cmake version
|
54 |
# 2012-01-06 PH removed pcre_info.c and added pcre_string_utils.c
|
55 |
# 2012-01-10 Zoltan Herczeg added libpcre16 support
|
56 |
# 2012-01-13 Stephen Kelly added out of source build support
|
57 |
# 2012-01-17 PH applied Stephen Kelly's patch to parse the version data out
|
58 |
# of the configure.ac file
|
59 |
# 2012-02-26 PH added support for libedit
|
60 |
# 2012-09-06 PH added support for PCRE_EBCDIC_NL25
|
61 |
# 2012-09-08 ChPe added PCRE32 support
|
62 |
# 2012-10-23 PH added support for VALGRIND and GCOV
|
63 |
# 2012-12-08 PH added patch from Daniel Richard G to quash some MSVC warnings
|
64 |
# 2013-07-01 PH realized that the "support" for GCOV was a total nonsense and
|
65 |
# so it has been removed.
|
66 |
# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
|
67 |
# 2013-11-05 PH added support for PARENS_NEST_LIMIT
|
68 |
|
69 |
PROJECT(PCRE C CXX)
|
70 |
|
71 |
# Increased minimum to 2.8.0 to support newer add_test features
|
72 |
|
73 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
|
74 |
|
75 |
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
|
76 |
|
77 |
# external packages
|
78 |
FIND_PACKAGE( BZip2 )
|
79 |
FIND_PACKAGE( ZLIB )
|
80 |
FIND_PACKAGE( Readline )
|
81 |
FIND_PACKAGE( Editline )
|
82 |
|
83 |
# Configuration checks
|
84 |
|
85 |
INCLUDE(CheckIncludeFile)
|
86 |
INCLUDE(CheckIncludeFileCXX)
|
87 |
INCLUDE(CheckFunctionExists)
|
88 |
INCLUDE(CheckTypeSize)
|
89 |
|
90 |
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
|
91 |
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
|
92 |
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
|
93 |
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
|
94 |
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
|
95 |
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
|
96 |
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
|
97 |
|
98 |
CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H)
|
99 |
CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H)
|
100 |
|
101 |
CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY)
|
102 |
CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
|
103 |
CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
|
104 |
CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
|
105 |
CHECK_FUNCTION_EXISTS(strtoq HAVE_STRTOQ)
|
106 |
CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
|
107 |
|
108 |
CHECK_TYPE_SIZE("long long" LONG_LONG)
|
109 |
CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
|
110 |
|
111 |
# User-configurable options
|
112 |
#
|
113 |
# (Note: CMakeSetup displays these in alphabetical order, regardless of
|
114 |
# the order we use here)
|
115 |
|
116 |
SET(BUILD_SHARED_LIBS OFF CACHE BOOL
|
117 |
"Build shared libraries instead of static ones.")
|
118 |
|
119 |
OPTION(PCRE_BUILD_PCRE8 "Build 8 bit PCRE library" ON)
|
120 |
|
121 |
OPTION(PCRE_BUILD_PCRE16 "Build 16 bit PCRE library" OFF)
|
122 |
|
123 |
OPTION(PCRE_BUILD_PCRE32 "Build 32 bit PCRE library" OFF)
|
124 |
|
125 |
OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
|
126 |
|
127 |
SET(PCRE_EBCDIC OFF CACHE BOOL
|
128 |
"Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)")
|
129 |
|
130 |
SET(PCRE_EBCDIC_NL25 OFF CACHE BOOL
|
131 |
"Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC.")
|
132 |
|
133 |
SET(PCRE_LINK_SIZE "2" CACHE STRING
|
134 |
"Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
|
135 |
|
136 |
SET(PCRE_PARENS_NEST_LIMIT "250" CACHE STRING
|
137 |
"Default nested parentheses limit. See PARENS_NEST_LIMIT in config.h.in for details.")
|
138 |
|
139 |
SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING
|
140 |
"Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
|
141 |
|
142 |
SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
|
143 |
"Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
|
144 |
|
145 |
SET(PCREGREP_BUFSIZE "20480" CACHE STRING
|
146 |
"Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
|
147 |
|
148 |
SET(PCRE_NEWLINE "LF" CACHE STRING
|
149 |
"What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
|
150 |
|
151 |
SET(PCRE_NO_RECURSE OFF CACHE BOOL
|
152 |
"If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
|
153 |
|
154 |
SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
|
155 |
"Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
|
156 |
|
157 |
SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
|
158 |
"Enable support for Just-in-time compiling.")
|
159 |
|
160 |
SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
|
161 |
"Enable use of Just-in-time compiling in pcregrep.")
|
162 |
|
163 |
SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
|
164 |
"Enable support for Unicode Transformation Format (UTF-8/UTF-16/UTF-32) encoding.")
|
165 |
|
166 |
SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
|
167 |
"Enable support for Unicode properties (if set, UTF support will be enabled as well).")
|
168 |
|
169 |
SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
|
170 |
"ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
|
171 |
|
172 |
SET(PCRE_SUPPORT_VALGRIND OFF CACHE BOOL
|
173 |
"Enable Valgrind support.")
|
174 |
|
175 |
OPTION(PCRE_SHOW_REPORT "Show the final configuration report" ON)
|
176 |
OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
|
177 |
OPTION(PCRE_BUILD_TESTS "Build the tests" ON)
|
178 |
|
179 |
IF (MINGW)
|
180 |
OPTION(NON_STANDARD_LIB_PREFIX
|
181 |
"ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
|
182 |
OFF)
|
183 |
|
184 |
OPTION(NON_STANDARD_LIB_SUFFIX
|
185 |
"ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
|
186 |
OFF)
|
187 |
ENDIF(MINGW)
|
188 |
|
189 |
# bzip2 lib
|
190 |
IF(BZIP2_FOUND)
|
191 |
OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
|
192 |
ENDIF(BZIP2_FOUND)
|
193 |
IF(PCRE_SUPPORT_LIBBZ2)
|
194 |
INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
|
195 |
ENDIF(PCRE_SUPPORT_LIBBZ2)
|
196 |
|
197 |
# zlib
|
198 |
IF(ZLIB_FOUND)
|
199 |
OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
|
200 |
ENDIF(ZLIB_FOUND)
|
201 |
IF(PCRE_SUPPORT_LIBZ)
|
202 |
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
203 |
ENDIF(PCRE_SUPPORT_LIBZ)
|
204 |
|
205 |
# editline lib
|
206 |
IF(EDITLINE_FOUND)
|
207 |
OPTION (PCRE_SUPPORT_LIBEDIT "Enable support for linking pcretest with libedit." OFF)
|
208 |
ENDIF(EDITLINE_FOUND)
|
209 |
IF(PCRE_SUPPORT_LIBEDIT)
|
210 |
INCLUDE_DIRECTORIES(${EDITLINE_INCLUDE_DIR})
|
211 |
ENDIF(PCRE_SUPPORT_LIBEDIT)
|
212 |
|
213 |
# readline lib
|
214 |
IF(READLINE_FOUND)
|
215 |
OPTION (PCRE_SUPPORT_LIBREADLINE "Enable support for linking pcretest with libreadline." ON)
|
216 |
ENDIF(READLINE_FOUND)
|
217 |
IF(PCRE_SUPPORT_LIBREADLINE)
|
218 |
INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
|
219 |
ENDIF(PCRE_SUPPORT_LIBREADLINE)
|
220 |
|
221 |
# Prepare build configuration
|
222 |
|
223 |
SET(pcre_have_type_traits 0)
|
224 |
SET(pcre_have_bits_type_traits 0)
|
225 |
|
226 |
IF(HAVE_TYPE_TRAITS_H)
|
227 |
SET(pcre_have_type_traits 1)
|
228 |
ENDIF(HAVE_TYPE_TRAITS_H)
|
229 |
|
230 |
IF(HAVE_BITS_TYPE_TRAITS_H)
|
231 |
SET(pcre_have_bits_type_traits 1)
|
232 |
ENDIF(HAVE_BITS_TYPE_TRAITS_H)
|
233 |
|
234 |
SET(pcre_have_long_long 0)
|
235 |
SET(pcre_have_ulong_long 0)
|
236 |
|
237 |
IF(HAVE_LONG_LONG)
|
238 |
SET(pcre_have_long_long 1)
|
239 |
ENDIF(HAVE_LONG_LONG)
|
240 |
|
241 |
IF(HAVE_UNSIGNED_LONG_LONG)
|
242 |
SET(pcre_have_ulong_long 1)
|
243 |
ENDIF(HAVE_UNSIGNED_LONG_LONG)
|
244 |
|
245 |
IF(NOT BUILD_SHARED_LIBS)
|
246 |
SET(PCRE_STATIC 1)
|
247 |
ENDIF(NOT BUILD_SHARED_LIBS)
|
248 |
|
249 |
IF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16 AND NOT PCRE_BUILD_PCRE32)
|
250 |
MESSAGE(FATAL_ERROR "At least one of PCRE_BUILD_PCRE8, PCRE_BUILD_PCRE16 or PCRE_BUILD_PCRE32 must be enabled")
|
251 |
ENDIF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16 AND NOT PCRE_BUILD_PCRE32)
|
252 |
|
253 |
IF(PCRE_BUILD_PCRE8)
|
254 |
SET(SUPPORT_PCRE8 1)
|
255 |
ENDIF(PCRE_BUILD_PCRE8)
|
256 |
|
257 |
IF(PCRE_BUILD_PCRE16)
|
258 |
SET(SUPPORT_PCRE16 1)
|
259 |
ENDIF(PCRE_BUILD_PCRE16)
|
260 |
|
261 |
IF(PCRE_BUILD_PCRE32)
|
262 |
SET(SUPPORT_PCRE32 1)
|
263 |
ENDIF(PCRE_BUILD_PCRE32)
|
264 |
|
265 |
IF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
|
266 |
MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the C++ library support")
|
267 |
SET(PCRE_BUILD_PCRECPP OFF)
|
268 |
ENDIF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
|
269 |
|
270 |
IF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
|
271 |
MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the pcregrep program")
|
272 |
SET(PCRE_BUILD_PCREGREP OFF)
|
273 |
ENDIF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
|
274 |
|
275 |
IF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
|
276 |
MESSAGE(FATAL_ERROR "Only one of libreadline or libeditline can be specified")
|
277 |
ENDIF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
|
278 |
|
279 |
IF(PCRE_SUPPORT_BSR_ANYCRLF)
|
280 |
SET(BSR_ANYCRLF 1)
|
281 |
ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
|
282 |
|
283 |
IF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
|
284 |
SET(SUPPORT_UTF 1)
|
285 |
SET(PCRE_SUPPORT_UTF ON)
|
286 |
ENDIF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
|
287 |
|
288 |
IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
|
289 |
SET(SUPPORT_UCP 1)
|
290 |
ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
|
291 |
|
292 |
IF(PCRE_SUPPORT_JIT)
|
293 |
SET(SUPPORT_JIT 1)
|
294 |
ENDIF(PCRE_SUPPORT_JIT)
|
295 |
|
296 |
IF(PCRE_SUPPORT_PCREGREP_JIT)
|
297 |
SET(SUPPORT_PCREGREP_JIT 1)
|
298 |
ENDIF(PCRE_SUPPORT_PCREGREP_JIT)
|
299 |
|
300 |
IF(PCRE_SUPPORT_VALGRIND)
|
301 |
SET(SUPPORT_VALGRIND 1)
|
302 |
ENDIF(PCRE_SUPPORT_VALGRIND)
|
303 |
|
304 |
# This next one used to contain
|
305 |
# SET(PCRETEST_LIBS ${READLINE_LIBRARY})
|
306 |
# but I was advised to add the NCURSES test as well, along with
|
307 |
# some modifications to cmake/FindReadline.cmake which should
|
308 |
# make it possible to override the default if necessary. PH
|
309 |
|
310 |
IF(PCRE_SUPPORT_LIBREADLINE)
|
311 |
SET(SUPPORT_LIBREADLINE 1)
|
312 |
SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
|
313 |
ENDIF(PCRE_SUPPORT_LIBREADLINE)
|
314 |
|
315 |
# libedit is a plug-compatible alternative to libreadline
|
316 |
|
317 |
IF(PCRE_SUPPORT_LIBEDIT)
|
318 |
SET(SUPPORT_LIBEDIT 1)
|
319 |
SET(PCRETEST_LIBS ${EDITLINE_LIBRARY} ${NCURSES_LIBRARY})
|
320 |
ENDIF(PCRE_SUPPORT_LIBEDIT)
|
321 |
|
322 |
IF(PCRE_SUPPORT_LIBZ)
|
323 |
SET(SUPPORT_LIBZ 1)
|
324 |
SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
|
325 |
ENDIF(PCRE_SUPPORT_LIBZ)
|
326 |
|
327 |
IF(PCRE_SUPPORT_LIBBZ2)
|
328 |
SET(SUPPORT_LIBBZ2 1)
|
329 |
SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
|
330 |
ENDIF(PCRE_SUPPORT_LIBBZ2)
|
331 |
|
332 |
SET(NEWLINE "")
|
333 |
|
334 |
IF(PCRE_NEWLINE STREQUAL "LF")
|
335 |
SET(NEWLINE "10")
|
336 |
ENDIF(PCRE_NEWLINE STREQUAL "LF")
|
337 |
IF(PCRE_NEWLINE STREQUAL "CR")
|
338 |
SET(NEWLINE "13")
|
339 |
ENDIF(PCRE_NEWLINE STREQUAL "CR")
|
340 |
IF(PCRE_NEWLINE STREQUAL "CRLF")
|
341 |
SET(NEWLINE "3338")
|
342 |
ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
|
343 |
IF(PCRE_NEWLINE STREQUAL "ANY")
|
344 |
SET(NEWLINE "-1")
|
345 |
ENDIF(PCRE_NEWLINE STREQUAL "ANY")
|
346 |
IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
|
347 |
SET(NEWLINE "-2")
|
348 |
ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
|
349 |
|
350 |
IF(NEWLINE STREQUAL "")
|
351 |
MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
|
352 |
ENDIF(NEWLINE STREQUAL "")
|
353 |
|
354 |
IF(PCRE_EBCDIC)
|
355 |
SET(EBCDIC 1)
|
356 |
IF(PCRE_NEWLINE STREQUAL "LF")
|
357 |
SET(NEWLINE "21")
|
358 |
ENDIF(PCRE_NEWLINE STREQUAL "LF")
|
359 |
IF(PCRE_NEWLINE STREQUAL "CRLF")
|
360 |
SET(NEWLINE "3349")
|
361 |
ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
|
362 |
ENDIF(PCRE_EBCDIC)
|
363 |
|
364 |
IF(PCRE_EBCDIC_NL25)
|
365 |
SET(EBCDIC 1)
|
366 |
SET(EBCDIC_NL25 1)
|
367 |
IF(PCRE_NEWLINE STREQUAL "LF")
|
368 |
SET(NEWLINE "37")
|
369 |
ENDIF(PCRE_NEWLINE STREQUAL "LF")
|
370 |
IF(PCRE_NEWLINE STREQUAL "CRLF")
|
371 |
SET(NEWLINE "3365")
|
372 |
ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
|
373 |
ENDIF(PCRE_EBCDIC_NL25)
|
374 |
|
375 |
IF(PCRE_NO_RECURSE)
|
376 |
SET(NO_RECURSE 1)
|
377 |
ENDIF(PCRE_NO_RECURSE)
|
378 |
|
379 |
# Output files
|
380 |
CONFIGURE_FILE(config-cmake.h.in
|
381 |
${PROJECT_BINARY_DIR}/config.h
|
382 |
@ONLY)
|
383 |
|
384 |
# Parse version numbers and date out of configure.ac
|
385 |
|
386 |
file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
|
387 |
configure_lines
|
388 |
LIMIT_COUNT 50 # Read only the first 50 lines of the file
|
389 |
)
|
390 |
|
391 |
set(SEARCHED_VARIABLES "pcre_major" "pcre_minor" "pcre_prerelease" "pcre_date")
|
392 |
foreach(configure_line ${configure_lines})
|
393 |
foreach(_substitution_variable ${SEARCHED_VARIABLES})
|
394 |
string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
|
395 |
if (NOT ${_substitution_variable_upper})
|
396 |
string(REGEX MATCH "m4_define\\(${_substitution_variable}, \\[(.*)\\]" MACTHED_STRING ${configure_line})
|
397 |
if (CMAKE_MATCH_1)
|
398 |
set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
|
399 |
endif()
|
400 |
endif()
|
401 |
endforeach()
|
402 |
endforeach()
|
403 |
|
404 |
CONFIGURE_FILE(pcre.h.in
|
405 |
${PROJECT_BINARY_DIR}/pcre.h
|
406 |
@ONLY)
|
407 |
|
408 |
# What about pcre-config and libpcre.pc?
|
409 |
|
410 |
IF(PCRE_BUILD_PCRECPP)
|
411 |
CONFIGURE_FILE(pcre_stringpiece.h.in
|
412 |
${PROJECT_BINARY_DIR}/pcre_stringpiece.h
|
413 |
@ONLY)
|
414 |
|
415 |
CONFIGURE_FILE(pcrecpparg.h.in
|
416 |
${PROJECT_BINARY_DIR}/pcrecpparg.h
|
417 |
@ONLY)
|
418 |
ENDIF(PCRE_BUILD_PCRECPP)
|
419 |
|
420 |
# Character table generation
|
421 |
|
422 |
OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
|
423 |
IF(PCRE_REBUILD_CHARTABLES)
|
424 |
ADD_EXECUTABLE(dftables dftables.c)
|
425 |
|
426 |
GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
|
427 |
|
428 |
ADD_CUSTOM_COMMAND(
|
429 |
COMMENT "Generating character tables (pcre_chartables.c) for current locale"
|
430 |
DEPENDS dftables
|
431 |
COMMAND ${DFTABLES_EXE}
|
432 |
ARGS ${PROJECT_BINARY_DIR}/pcre_chartables.c
|
433 |
OUTPUT ${PROJECT_BINARY_DIR}/pcre_chartables.c
|
434 |
)
|
435 |
ELSE(PCRE_REBUILD_CHARTABLES)
|
436 |
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
|
437 |
${PROJECT_BINARY_DIR}/pcre_chartables.c
|
438 |
COPYONLY)
|
439 |
ENDIF(PCRE_REBUILD_CHARTABLES)
|
440 |
|
441 |
# Source code
|
442 |
|
443 |
SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
|
444 |
|
445 |
IF(PCRE_BUILD_PCRE8)
|
446 |
SET(PCRE_SOURCES
|
447 |
pcre_byte_order.c
|
448 |
pcre_chartables.c
|
449 |
pcre_compile.c
|
450 |
pcre_config.c
|
451 |
pcre_dfa_exec.c
|
452 |
pcre_exec.c
|
453 |
pcre_fullinfo.c
|
454 |
pcre_get.c
|
455 |
pcre_globals.c
|
456 |
pcre_jit_compile.c
|
457 |
pcre_maketables.c
|
458 |
pcre_newline.c
|
459 |
pcre_ord2utf8.c
|
460 |
pcre_refcount.c
|
461 |
pcre_string_utils.c
|
462 |
pcre_study.c
|
463 |
pcre_tables.c
|
464 |
pcre_ucd.c
|
465 |
pcre_valid_utf8.c
|
466 |
pcre_version.c
|
467 |
pcre_xclass.c
|
468 |
)
|
469 |
|
470 |
SET(PCREPOSIX_HEADERS pcreposix.h)
|
471 |
|
472 |
SET(PCREPOSIX_SOURCES pcreposix.c)
|
473 |
|
474 |
ENDIF(PCRE_BUILD_PCRE8)
|
475 |
|
476 |
IF(PCRE_BUILD_PCRE16)
|
477 |
SET(PCRE16_SOURCES
|
478 |
pcre16_byte_order.c
|
479 |
pcre16_chartables.c
|
480 |
pcre16_compile.c
|
481 |
pcre16_config.c
|
482 |
pcre16_dfa_exec.c
|
483 |
pcre16_exec.c
|
484 |
pcre16_fullinfo.c
|
485 |
pcre16_get.c
|
486 |
pcre16_globals.c
|
487 |
pcre16_jit_compile.c
|
488 |
pcre16_maketables.c
|
489 |
pcre16_newline.c
|
490 |
pcre16_ord2utf16.c
|
491 |
pcre16_refcount.c
|
492 |
pcre16_string_utils.c
|
493 |
pcre16_study.c
|
494 |
pcre16_tables.c
|
495 |
pcre16_ucd.c
|
496 |
pcre16_utf16_utils.c
|
497 |
pcre16_valid_utf16.c
|
498 |
pcre16_version.c
|
499 |
pcre16_xclass.c
|
500 |
)
|
501 |
ENDIF(PCRE_BUILD_PCRE16)
|
502 |
|
503 |
IF(PCRE_BUILD_PCRE32)
|
504 |
SET(PCRE32_SOURCES
|
505 |
pcre32_byte_order.c
|
506 |
pcre32_chartables.c
|
507 |
pcre32_compile.c
|
508 |
pcre32_config.c
|
509 |
pcre32_dfa_exec.c
|
510 |
pcre32_exec.c
|
511 |
pcre32_fullinfo.c
|
512 |
pcre32_get.c
|
513 |
pcre32_globals.c
|
514 |
pcre32_jit_compile.c
|
515 |
pcre32_maketables.c
|
516 |
pcre32_newline.c
|
517 |
pcre32_ord2utf32.c
|
518 |
pcre32_refcount.c
|
519 |
pcre32_string_utils.c
|
520 |
pcre32_study.c
|
521 |
pcre32_tables.c
|
522 |
pcre32_ucd.c
|
523 |
pcre32_utf32_utils.c
|
524 |
pcre32_valid_utf32.c
|
525 |
pcre32_version.c
|
526 |
pcre32_xclass.c
|
527 |
)
|
528 |
ENDIF(PCRE_BUILD_PCRE32)
|
529 |
|
530 |
IF(MINGW AND NOT PCRE_STATIC)
|
531 |
IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
|
532 |
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre.o
|
533 |
PRE-LINK
|
534 |
COMMAND windres ARGS pcre.rc pcre.o
|
535 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
536 |
COMMENT Using pcre coff info in mingw build)
|
537 |
SET(PCRE_SOURCES
|
538 |
${PCRE_SOURCES} ${PROJECT_SOURCE_DIR}/pcre.o
|
539 |
)
|
540 |
ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
|
541 |
IF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
|
542 |
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcreposix.o
|
543 |
PRE-LINK
|
544 |
COMMAND windres ARGS pcreposix.rc pcreposix.o
|
545 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
546 |
COMMENT Using pcreposix coff info in mingw build)
|
547 |
SET(PCREPOSIX_SOURCES
|
548 |
${PCREPOSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcreposix.o
|
549 |
)
|
550 |
ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
|
551 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
552 |
|
553 |
SET(PCRECPP_HEADERS
|
554 |
pcrecpp.h
|
555 |
pcre_scanner.h
|
556 |
${PROJECT_BINARY_DIR}/pcrecpparg.h
|
557 |
${PROJECT_BINARY_DIR}/pcre_stringpiece.h
|
558 |
)
|
559 |
|
560 |
SET(PCRECPP_SOURCES
|
561 |
pcrecpp.cc
|
562 |
pcre_scanner.cc
|
563 |
pcre_stringpiece.cc
|
564 |
)
|
565 |
|
566 |
# Build setup
|
567 |
|
568 |
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
569 |
|
570 |
IF(MSVC)
|
571 |
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
|
572 |
ENDIF(MSVC)
|
573 |
|
574 |
SET(CMAKE_INCLUDE_CURRENT_DIR 1)
|
575 |
# needed to make sure to not link debug libs
|
576 |
# against release libs and vice versa
|
577 |
IF(WIN32)
|
578 |
SET(CMAKE_DEBUG_POSTFIX "d")
|
579 |
ENDIF(WIN32)
|
580 |
|
581 |
SET(targets)
|
582 |
|
583 |
# Libraries
|
584 |
# pcre
|
585 |
IF(PCRE_BUILD_PCRE8)
|
586 |
ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
|
587 |
SET(targets ${targets} pcre)
|
588 |
ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
|
589 |
SET(targets ${targets} pcreposix)
|
590 |
TARGET_LINK_LIBRARIES(pcreposix pcre)
|
591 |
|
592 |
IF(MINGW AND NOT PCRE_STATIC)
|
593 |
IF(NON_STANDARD_LIB_PREFIX)
|
594 |
SET_TARGET_PROPERTIES(pcre pcreposix
|
595 |
PROPERTIES PREFIX ""
|
596 |
)
|
597 |
ENDIF(NON_STANDARD_LIB_PREFIX)
|
598 |
|
599 |
IF(NON_STANDARD_LIB_SUFFIX)
|
600 |
SET_TARGET_PROPERTIES(pcre pcreposix
|
601 |
PROPERTIES SUFFIX "-0.dll"
|
602 |
)
|
603 |
ENDIF(NON_STANDARD_LIB_SUFFIX)
|
604 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
605 |
|
606 |
ENDIF(PCRE_BUILD_PCRE8)
|
607 |
|
608 |
IF(PCRE_BUILD_PCRE16)
|
609 |
ADD_LIBRARY(pcre16 ${PCRE_HEADERS} ${PCRE16_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
|
610 |
SET(targets ${targets} pcre16)
|
611 |
|
612 |
IF(MINGW AND NOT PCRE_STATIC)
|
613 |
IF(NON_STANDARD_LIB_PREFIX)
|
614 |
SET_TARGET_PROPERTIES(pcre16
|
615 |
PROPERTIES PREFIX ""
|
616 |
)
|
617 |
ENDIF(NON_STANDARD_LIB_PREFIX)
|
618 |
|
619 |
IF(NON_STANDARD_LIB_SUFFIX)
|
620 |
SET_TARGET_PROPERTIES(pcre16
|
621 |
PROPERTIES SUFFIX "-0.dll"
|
622 |
)
|
623 |
ENDIF(NON_STANDARD_LIB_SUFFIX)
|
624 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
625 |
|
626 |
ENDIF(PCRE_BUILD_PCRE16)
|
627 |
|
628 |
IF(PCRE_BUILD_PCRE32)
|
629 |
ADD_LIBRARY(pcre32 ${PCRE_HEADERS} ${PCRE32_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
|
630 |
SET(targets ${targets} pcre32)
|
631 |
|
632 |
IF(MINGW AND NOT PCRE_STATIC)
|
633 |
IF(NON_STANDARD_LIB_PREFIX)
|
634 |
SET_TARGET_PROPERTIES(pcre32
|
635 |
PROPERTIES PREFIX ""
|
636 |
)
|
637 |
ENDIF(NON_STANDARD_LIB_PREFIX)
|
638 |
|
639 |
IF(NON_STANDARD_LIB_SUFFIX)
|
640 |
SET_TARGET_PROPERTIES(pcre32
|
641 |
PROPERTIES SUFFIX "-0.dll"
|
642 |
)
|
643 |
ENDIF(NON_STANDARD_LIB_SUFFIX)
|
644 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
645 |
|
646 |
ENDIF(PCRE_BUILD_PCRE32)
|
647 |
|
648 |
# pcrecpp
|
649 |
IF(PCRE_BUILD_PCRECPP)
|
650 |
ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
|
651 |
SET(targets ${targets} pcrecpp)
|
652 |
TARGET_LINK_LIBRARIES(pcrecpp pcre)
|
653 |
|
654 |
IF(MINGW AND NOT PCRE_STATIC)
|
655 |
IF(NON_STANDARD_LIB_PREFIX)
|
656 |
SET_TARGET_PROPERTIES(pcrecpp
|
657 |
PROPERTIES PREFIX ""
|
658 |
)
|
659 |
ENDIF(NON_STANDARD_LIB_PREFIX)
|
660 |
|
661 |
IF(NON_STANDARD_LIB_SUFFIX)
|
662 |
SET_TARGET_PROPERTIES(pcrecpp
|
663 |
PROPERTIES SUFFIX "-0.dll"
|
664 |
)
|
665 |
ENDIF(NON_STANDARD_LIB_SUFFIX)
|
666 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
667 |
ENDIF(PCRE_BUILD_PCRECPP)
|
668 |
|
669 |
|
670 |
# Executables
|
671 |
|
672 |
# Removed by PH (2008-01-23) because pcredemo shouldn't really be built
|
673 |
# automatically, and it gave trouble in some environments anyway.
|
674 |
# ADD_EXECUTABLE(pcredemo pcredemo.c)
|
675 |
# TARGET_LINK_LIBRARIES(pcredemo pcreposix)
|
676 |
# IF(NOT BUILD_SHARED_LIBS)
|
677 |
# # make sure to not use declspec(dllimport) in static mode on windows
|
678 |
# SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
|
679 |
# ENDIF(NOT BUILD_SHARED_LIBS)
|
680 |
|
681 |
IF(PCRE_BUILD_PCREGREP)
|
682 |
ADD_EXECUTABLE(pcregrep pcregrep.c)
|
683 |
SET(targets ${targets} pcregrep)
|
684 |
TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
|
685 |
ENDIF(PCRE_BUILD_PCREGREP)
|
686 |
|
687 |
# Testing
|
688 |
IF(PCRE_BUILD_TESTS)
|
689 |
ENABLE_TESTING()
|
690 |
|
691 |
SET(PCRETEST_SOURCES pcretest.c)
|
692 |
IF(PCRE_BUILD_PCRE8)
|
693 |
LIST(APPEND PCRETEST_SOURCES pcre_printint.c)
|
694 |
ENDIF(PCRE_BUILD_PCRE8)
|
695 |
IF(PCRE_BUILD_PCRE16)
|
696 |
LIST(APPEND PCRETEST_SOURCES pcre16_printint.c)
|
697 |
ENDIF(PCRE_BUILD_PCRE16)
|
698 |
IF(PCRE_BUILD_PCRE32)
|
699 |
LIST(APPEND PCRETEST_SOURCES pcre32_printint.c)
|
700 |
ENDIF(PCRE_BUILD_PCRE32)
|
701 |
|
702 |
ADD_EXECUTABLE(pcretest ${PCRETEST_SOURCES})
|
703 |
SET(targets ${targets} pcretest)
|
704 |
IF(PCRE_BUILD_PCRE8)
|
705 |
LIST(APPEND PCRETEST_LIBS pcreposix pcre)
|
706 |
ENDIF(PCRE_BUILD_PCRE8)
|
707 |
IF(PCRE_BUILD_PCRE16)
|
708 |
LIST(APPEND PCRETEST_LIBS pcre16)
|
709 |
ENDIF(PCRE_BUILD_PCRE16)
|
710 |
IF(PCRE_BUILD_PCRE32)
|
711 |
LIST(APPEND PCRETEST_LIBS pcre32)
|
712 |
ENDIF(PCRE_BUILD_PCRE32)
|
713 |
TARGET_LINK_LIBRARIES(pcretest ${PCRETEST_LIBS})
|
714 |
|
715 |
IF(PCRE_SUPPORT_JIT)
|
716 |
ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
|
717 |
SET(targets ${targets} pcre_jit_test)
|
718 |
SET(PCRE_JIT_TEST_LIBS )
|
719 |
IF(PCRE_BUILD_PCRE8)
|
720 |
LIST(APPEND PCRE_JIT_TEST_LIBS pcre)
|
721 |
ENDIF(PCRE_BUILD_PCRE8)
|
722 |
IF(PCRE_BUILD_PCRE16)
|
723 |
LIST(APPEND PCRE_JIT_TEST_LIBS pcre16)
|
724 |
ENDIF(PCRE_BUILD_PCRE16)
|
725 |
IF(PCRE_BUILD_PCRE32)
|
726 |
LIST(APPEND PCRE_JIT_TEST_LIBS pcre32)
|
727 |
ENDIF(PCRE_BUILD_PCRE32)
|
728 |
TARGET_LINK_LIBRARIES(pcre_jit_test ${PCRE_JIT_TEST_LIBS})
|
729 |
ENDIF(PCRE_SUPPORT_JIT)
|
730 |
|
731 |
IF(PCRE_BUILD_PCRECPP)
|
732 |
ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
|
733 |
SET(targets ${targets} pcrecpp_unittest)
|
734 |
TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
|
735 |
IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
|
736 |
SET_TARGET_PROPERTIES(pcrecpp
|
737 |
PROPERTIES PREFIX ""
|
738 |
)
|
739 |
ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
|
740 |
|
741 |
ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
|
742 |
SET(targets ${targets} pcre_scanner_unittest)
|
743 |
TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
|
744 |
|
745 |
ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
|
746 |
SET(targets ${targets} pcre_stringpiece_unittest)
|
747 |
TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
|
748 |
ENDIF(PCRE_BUILD_PCRECPP)
|
749 |
|
750 |
# exes in Debug location tested by the RunTest shell script
|
751 |
# via "make test"
|
752 |
IF(PCRE_BUILD_PCREGREP)
|
753 |
GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
|
754 |
ENDIF(PCRE_BUILD_PCREGREP)
|
755 |
|
756 |
GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
|
757 |
|
758 |
# =================================================
|
759 |
# Write out a CTest configuration file
|
760 |
#
|
761 |
FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
|
762 |
"# This is a generated file.
|
763 |
MESSAGE(\"When testing is complete, review test output in the
|
764 |
\\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
|
765 |
MESSAGE(\" \")
|
766 |
")
|
767 |
|
768 |
FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
|
769 |
"#! /bin/sh
|
770 |
# This is a generated file.
|
771 |
srcdir=${PROJECT_SOURCE_DIR}
|
772 |
pcretest=${PCRETEST_EXE}
|
773 |
. ${PROJECT_SOURCE_DIR}/RunTest
|
774 |
if test \"$?\" != \"0\"; then exit 1; fi
|
775 |
# End
|
776 |
")
|
777 |
|
778 |
IF(UNIX)
|
779 |
ADD_TEST(pcre_test sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
|
780 |
ENDIF(UNIX)
|
781 |
|
782 |
IF(PCRE_BUILD_PCREGREP)
|
783 |
FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
|
784 |
"#! /bin/sh
|
785 |
# This is a generated file.
|
786 |
srcdir=${PROJECT_SOURCE_DIR}
|
787 |
pcregrep=${PCREGREP_EXE}
|
788 |
pcretest=${PCRETEST_EXE}
|
789 |
. ${PROJECT_SOURCE_DIR}/RunGrepTest
|
790 |
if test \"$?\" != \"0\"; then exit 1; fi
|
791 |
# End
|
792 |
")
|
793 |
|
794 |
IF(UNIX)
|
795 |
ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
|
796 |
ENDIF(UNIX)
|
797 |
ENDIF(PCRE_BUILD_PCREGREP)
|
798 |
|
799 |
IF(WIN32)
|
800 |
# Provide environment for executing the bat file version of RunTest
|
801 |
FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
|
802 |
FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)
|
803 |
FILE(TO_NATIVE_PATH ${PCRETEST_EXE} winexe)
|
804 |
|
805 |
FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.bat
|
806 |
"\@REM This is a generated file.
|
807 |
\@echo off
|
808 |
setlocal
|
809 |
SET srcdir=\"${winsrc}\"
|
810 |
SET pcretest=\"${winexe}\"
|
811 |
if not [%CMAKE_CONFIG_TYPE%]==[] SET pcretest=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcretest.exe\"
|
812 |
call %srcdir%\\RunTest.Bat
|
813 |
if errorlevel 1 exit /b 1
|
814 |
echo RunTest.bat tests successfully completed
|
815 |
")
|
816 |
|
817 |
ADD_TEST(NAME pcre_test_bat
|
818 |
COMMAND pcre_test.bat)
|
819 |
SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
|
820 |
PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
|
821 |
|
822 |
IF("$ENV{OSTYPE}" STREQUAL "msys")
|
823 |
# Both the sh and bat file versions of RunTest are run if make test is used
|
824 |
# in msys
|
825 |
ADD_TEST(pcre_test_sh sh.exe ${PROJECT_BINARY_DIR}/pcre_test.sh)
|
826 |
IF(PCRE_BUILD_PCREGREP)
|
827 |
ADD_TEST(pcre_grep_test sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
|
828 |
ENDIF(PCRE_BUILD_PCREGREP)
|
829 |
ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
|
830 |
|
831 |
ENDIF(WIN32)
|
832 |
|
833 |
# Changed to accommodate testing whichever location was just built
|
834 |
|
835 |
IF(PCRE_SUPPORT_JIT)
|
836 |
ADD_TEST(pcre_jit_test pcre_jit_test)
|
837 |
ENDIF(PCRE_SUPPORT_JIT)
|
838 |
|
839 |
IF(PCRE_BUILD_PCRECPP)
|
840 |
ADD_TEST(pcrecpp_test pcrecpp_unittest)
|
841 |
ADD_TEST(pcre_scanner_test pcre_scanner_unittest)
|
842 |
ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
|
843 |
ENDIF(PCRE_BUILD_PCRECPP)
|
844 |
|
845 |
ENDIF(PCRE_BUILD_TESTS)
|
846 |
|
847 |
# Installation
|
848 |
SET(CMAKE_INSTALL_ALWAYS 1)
|
849 |
|
850 |
INSTALL(TARGETS ${targets}
|
851 |
RUNTIME DESTINATION bin
|
852 |
LIBRARY DESTINATION lib
|
853 |
ARCHIVE DESTINATION lib)
|
854 |
|
855 |
INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
|
856 |
|
857 |
FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
|
858 |
FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
|
859 |
FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
|
860 |
|
861 |
IF(PCRE_BUILD_PCRECPP)
|
862 |
INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
|
863 |
ELSE(PCRE_BUILD_PCRECPP)
|
864 |
# Remove pcrecpp.3
|
865 |
FOREACH(man ${man3})
|
866 |
GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
|
867 |
IF(NOT man_tmp STREQUAL "pcrecpp.3")
|
868 |
SET(man3_new ${man3} ${man})
|
869 |
ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
|
870 |
ENDFOREACH(man ${man3})
|
871 |
SET(man3 ${man3_new})
|
872 |
ENDIF(PCRE_BUILD_PCRECPP)
|
873 |
|
874 |
INSTALL(FILES ${man1} DESTINATION man/man1)
|
875 |
INSTALL(FILES ${man3} DESTINATION man/man3)
|
876 |
INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
|
877 |
|
878 |
# help, only for nice output
|
879 |
IF(BUILD_SHARED_LIBS)
|
880 |
SET(BUILD_STATIC_LIBS OFF)
|
881 |
ELSE(BUILD_SHARED_LIBS)
|
882 |
SET(BUILD_STATIC_LIBS ON)
|
883 |
ENDIF(BUILD_SHARED_LIBS)
|
884 |
|
885 |
IF(PCRE_SHOW_REPORT)
|
886 |
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
|
887 |
IF (CMAKE_C_FLAGS)
|
888 |
SET(cfsp " ")
|
889 |
ENDIF(CMAKE_C_FLAGS)
|
890 |
IF (CMAKE_CXX_FLAGS)
|
891 |
SET(cxxfsp " ")
|
892 |
ENDIF(CMAKE_CXX_FLAGS)
|
893 |
MESSAGE(STATUS "")
|
894 |
MESSAGE(STATUS "")
|
895 |
MESSAGE(STATUS "PCRE configuration summary:")
|
896 |
MESSAGE(STATUS "")
|
897 |
MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
|
898 |
MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
|
899 |
MESSAGE(STATUS " C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
|
900 |
MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
|
901 |
MESSAGE(STATUS " C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
|
902 |
MESSAGE(STATUS "")
|
903 |
MESSAGE(STATUS " Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
|
904 |
MESSAGE(STATUS " Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
|
905 |
MESSAGE(STATUS " Build 32 bit PCRE library ....... : ${PCRE_BUILD_PCRE32}")
|
906 |
MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
|
907 |
MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
|
908 |
MESSAGE(STATUS " Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
|
909 |
MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
|
910 |
MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}")
|
911 |
MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
|
912 |
MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE_EBCDIC}")
|
913 |
MESSAGE(STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE_EBCDIC_NL25}")
|
914 |
MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
|
915 |
MESSAGE(STATUS " No stack recursion .............. : ${PCRE_NO_RECURSE}")
|
916 |
MESSAGE(STATUS " POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
|
917 |
MESSAGE(STATUS " Internal link size .............. : ${PCRE_LINK_SIZE}")
|
918 |
MESSAGE(STATUS " Parentheses nest limit .......... : ${PCRE_PARENS_NEST_LIMIT}")
|
919 |
MESSAGE(STATUS " Match limit ..................... : ${PCRE_MATCH_LIMIT}")
|
920 |
MESSAGE(STATUS " Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
|
921 |
MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}")
|
922 |
MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}")
|
923 |
MESSAGE(STATUS " Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
|
924 |
MESSAGE(STATUS " Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
|
925 |
MESSAGE(STATUS " Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
|
926 |
MESSAGE(STATUS " Build tests (implies pcretest .. : ${PCRE_BUILD_TESTS}")
|
927 |
MESSAGE(STATUS " and pcregrep)")
|
928 |
IF(ZLIB_FOUND)
|
929 |
MESSAGE(STATUS " Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
|
930 |
ELSE(ZLIB_FOUND)
|
931 |
MESSAGE(STATUS " Link pcregrep with libz ......... : Library not found" )
|
932 |
ENDIF(ZLIB_FOUND)
|
933 |
IF(BZIP2_FOUND)
|
934 |
MESSAGE(STATUS " Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
|
935 |
ELSE(BZIP2_FOUND)
|
936 |
MESSAGE(STATUS " Link pcregrep with libbz2 ....... : Library not found" )
|
937 |
ENDIF(BZIP2_FOUND)
|
938 |
IF(EDITLINE_FOUND)
|
939 |
MESSAGE(STATUS " Link pcretest with libeditline .. : ${PCRE_SUPPORT_LIBEDIT}")
|
940 |
ELSE(EDITLINE_FOUND)
|
941 |
MESSAGE(STATUS " Link pcretest with libeditline .. : Library not found" )
|
942 |
ENDIF(EDITLINE_FOUND)
|
943 |
IF(READLINE_FOUND)
|
944 |
MESSAGE(STATUS " Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
|
945 |
ELSE(READLINE_FOUND)
|
946 |
MESSAGE(STATUS " Link pcretest with libreadline .. : Library not found" )
|
947 |
ENDIF(READLINE_FOUND)
|
948 |
MESSAGE(STATUS " Support Valgrind .................: ${PCRE_SUPPORT_VALGRIND}")
|
949 |
MESSAGE(STATUS " Support coverage .................: ${PCRE_SUPPORT_COVERAGE}")
|
950 |
|
951 |
IF(MINGW AND NOT PCRE_STATIC)
|
952 |
MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
|
953 |
MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
|
954 |
ENDIF(MINGW AND NOT PCRE_STATIC)
|
955 |
MESSAGE(STATUS "")
|
956 |
ENDIF(PCRE_SHOW_REPORT)
|
957 |
|
958 |
# end CMakeLists.txt
|