/[pcre]/code/trunk/CMakeLists.txt
ViewVC logotype

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1765 - (show annotations)
Mon Jun 14 11:21:20 2021 UTC (8 days, 9 hours ago) by ph10
File MIME type: text/plain
File size: 36064 byte(s)
Error occurred while calculating annotation data.
Fix a few small bugs and typos and update docs for a final release.
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 # 2016-03-01 PH applied Chris Wilson's patch for MSVC static build
69 # 2016-06-24 PH applied Chris Wilson's revised patch (adds a separate option)
70 # 2021-06-14 PH changed CMAKE_MODULE_PATH definition to add, not replace
71 # 2021-06-14 PH applied Wolfgang Stöggl's patch for generating pcre-config and
72 # libpcre*.pc files (Bugzilla #2583)
73
74 PROJECT(PCRE C CXX)
75
76 # Increased minimum to 2.8.5 to support GNUInstallDirs. Set policy
77 # CMP0026 to avoid warnings for the use of LOCATION in GET_TARGET_PROPERTY.
78
79 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
80 CMAKE_POLICY(SET CMP0026 OLD)
81
82 # For FindReadline.cmake. This was changed to allow setting CMAKE_MODULE_PATH
83 # on the command line.
84 # SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
85
86 LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
87
88 # external packages
89 FIND_PACKAGE( BZip2 )
90 FIND_PACKAGE( ZLIB )
91 FIND_PACKAGE( Readline )
92 FIND_PACKAGE( Editline )
93
94 # Configuration checks
95
96 INCLUDE(CheckIncludeFile)
97 INCLUDE(CheckIncludeFileCXX)
98 INCLUDE(CheckFunctionExists)
99 INCLUDE(CheckTypeSize)
100 INCLUDE(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR
101
102 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
103 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
104 CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
105 CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
106 CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
107 CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
108 CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
109
110 CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H)
111 CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H)
112
113 CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY)
114 CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
115 CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
116 CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
117 CHECK_FUNCTION_EXISTS(strtoq HAVE_STRTOQ)
118 CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
119
120 CHECK_TYPE_SIZE("long long" LONG_LONG)
121 CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
122
123 # User-configurable options
124 #
125 # (Note: CMakeSetup displays these in alphabetical order, regardless of
126 # the order we use here)
127
128 SET(BUILD_SHARED_LIBS OFF CACHE BOOL
129 "Build shared libraries instead of static ones.")
130
131 OPTION(PCRE_BUILD_PCRE8 "Build 8 bit PCRE library" ON)
132
133 OPTION(PCRE_BUILD_PCRE16 "Build 16 bit PCRE library" OFF)
134
135 OPTION(PCRE_BUILD_PCRE32 "Build 32 bit PCRE library" OFF)
136
137 OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
138
139 SET(PCRE_EBCDIC OFF CACHE BOOL
140 "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)")
141
142 SET(PCRE_EBCDIC_NL25 OFF CACHE BOOL
143 "Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC.")
144
145 SET(PCRE_LINK_SIZE "2" CACHE STRING
146 "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
147
148 SET(PCRE_PARENS_NEST_LIMIT "250" CACHE STRING
149 "Default nested parentheses limit. See PARENS_NEST_LIMIT in config.h.in for details.")
150
151 SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING
152 "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
153
154 SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
155 "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
156
157 SET(PCREGREP_BUFSIZE "20480" CACHE STRING
158 "Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
159
160 SET(PCRE_NEWLINE "LF" CACHE STRING
161 "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
162
163 SET(PCRE_NO_RECURSE OFF CACHE BOOL
164 "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
165
166 SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
167 "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
168
169 SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
170 "Enable support for Just-in-time compiling.")
171
172 SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
173 "Enable use of Just-in-time compiling in pcregrep.")
174
175 SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
176 "Enable support for Unicode Transformation Format (UTF-8/UTF-16/UTF-32) encoding.")
177
178 SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
179 "Enable support for Unicode properties (if set, UTF support will be enabled as well).")
180
181 SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
182 "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
183
184 SET(PCRE_SUPPORT_VALGRIND OFF CACHE BOOL
185 "Enable Valgrind support.")
186
187 OPTION(PCRE_SHOW_REPORT "Show the final configuration report" ON)
188 OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
189 OPTION(PCRE_BUILD_TESTS "Build the tests" ON)
190
191 IF (MINGW)
192 OPTION(NON_STANDARD_LIB_PREFIX
193 "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
194 OFF)
195
196 OPTION(NON_STANDARD_LIB_SUFFIX
197 "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
198 OFF)
199 ENDIF(MINGW)
200
201 IF(MSVC)
202 OPTION(PCRE_STATIC_RUNTIME
203 "ON=Compile against the static runtime (/MT)."
204 OFF)
205 OPTION(INSTALL_MSVC_PDB
206 "ON=Install .pdb files built by MSVC, if generated"
207 OFF)
208 ENDIF(MSVC)
209
210 # bzip2 lib
211 IF(BZIP2_FOUND)
212 OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
213 ENDIF(BZIP2_FOUND)
214 IF(PCRE_SUPPORT_LIBBZ2)
215 INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
216 ENDIF(PCRE_SUPPORT_LIBBZ2)
217
218 # zlib
219 IF(ZLIB_FOUND)
220 OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
221 ENDIF(ZLIB_FOUND)
222 IF(PCRE_SUPPORT_LIBZ)
223 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
224 ENDIF(PCRE_SUPPORT_LIBZ)
225
226 # editline lib
227 IF(EDITLINE_FOUND)
228 OPTION (PCRE_SUPPORT_LIBEDIT "Enable support for linking pcretest with libedit." OFF)
229 ENDIF(EDITLINE_FOUND)
230 IF(PCRE_SUPPORT_LIBEDIT)
231 INCLUDE_DIRECTORIES(${EDITLINE_INCLUDE_DIR})
232 ENDIF(PCRE_SUPPORT_LIBEDIT)
233
234 # readline lib
235 IF(READLINE_FOUND)
236 OPTION (PCRE_SUPPORT_LIBREADLINE "Enable support for linking pcretest with libreadline." ON)
237 ENDIF(READLINE_FOUND)
238 IF(PCRE_SUPPORT_LIBREADLINE)
239 INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
240 ENDIF(PCRE_SUPPORT_LIBREADLINE)
241
242 # Prepare build configuration
243
244 SET(pcre_have_type_traits 0)
245 SET(pcre_have_bits_type_traits 0)
246
247 IF(HAVE_TYPE_TRAITS_H)
248 SET(pcre_have_type_traits 1)
249 ENDIF(HAVE_TYPE_TRAITS_H)
250
251 IF(HAVE_BITS_TYPE_TRAITS_H)
252 SET(pcre_have_bits_type_traits 1)
253 ENDIF(HAVE_BITS_TYPE_TRAITS_H)
254
255 SET(pcre_have_long_long 0)
256 SET(pcre_have_ulong_long 0)
257
258 IF(HAVE_LONG_LONG)
259 SET(pcre_have_long_long 1)
260 ENDIF(HAVE_LONG_LONG)
261
262 IF(HAVE_UNSIGNED_LONG_LONG)
263 SET(pcre_have_ulong_long 1)
264 ENDIF(HAVE_UNSIGNED_LONG_LONG)
265
266 IF(NOT BUILD_SHARED_LIBS)
267 SET(PCRE_STATIC 1)
268 ENDIF(NOT BUILD_SHARED_LIBS)
269
270 IF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16 AND NOT PCRE_BUILD_PCRE32)
271 MESSAGE(FATAL_ERROR "At least one of PCRE_BUILD_PCRE8, PCRE_BUILD_PCRE16 or PCRE_BUILD_PCRE32 must be enabled")
272 ENDIF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16 AND NOT PCRE_BUILD_PCRE32)
273
274 IF(PCRE_BUILD_PCRE8)
275 SET(SUPPORT_PCRE8 1)
276 ENDIF(PCRE_BUILD_PCRE8)
277
278 IF(PCRE_BUILD_PCRE16)
279 SET(SUPPORT_PCRE16 1)
280 ENDIF(PCRE_BUILD_PCRE16)
281
282 IF(PCRE_BUILD_PCRE32)
283 SET(SUPPORT_PCRE32 1)
284 ENDIF(PCRE_BUILD_PCRE32)
285
286 IF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
287 MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the C++ library support")
288 SET(PCRE_BUILD_PCRECPP OFF)
289 ENDIF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
290
291 IF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
292 MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the pcregrep program")
293 SET(PCRE_BUILD_PCREGREP OFF)
294 ENDIF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
295
296 IF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
297 MESSAGE(FATAL_ERROR "Only one of libreadline or libeditline can be specified")
298 ENDIF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
299
300 IF(PCRE_SUPPORT_BSR_ANYCRLF)
301 SET(BSR_ANYCRLF 1)
302 ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
303
304 IF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
305 SET(SUPPORT_UTF 1)
306 SET(PCRE_SUPPORT_UTF ON)
307 ENDIF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
308
309 IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
310 SET(SUPPORT_UCP 1)
311 ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
312
313 IF(PCRE_SUPPORT_JIT)
314 SET(SUPPORT_JIT 1)
315 ENDIF(PCRE_SUPPORT_JIT)
316
317 IF(PCRE_SUPPORT_PCREGREP_JIT)
318 SET(SUPPORT_PCREGREP_JIT 1)
319 ENDIF(PCRE_SUPPORT_PCREGREP_JIT)
320
321 IF(PCRE_SUPPORT_VALGRIND)
322 SET(SUPPORT_VALGRIND 1)
323 ENDIF(PCRE_SUPPORT_VALGRIND)
324
325 # This next one used to contain
326 # SET(PCRETEST_LIBS ${READLINE_LIBRARY})
327 # but I was advised to add the NCURSES test as well, along with
328 # some modifications to cmake/FindReadline.cmake which should
329 # make it possible to override the default if necessary. PH
330
331 IF(PCRE_SUPPORT_LIBREADLINE)
332 SET(SUPPORT_LIBREADLINE 1)
333 SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
334 ENDIF(PCRE_SUPPORT_LIBREADLINE)
335
336 # libedit is a plug-compatible alternative to libreadline
337
338 IF(PCRE_SUPPORT_LIBEDIT)
339 SET(SUPPORT_LIBEDIT 1)
340 SET(PCRETEST_LIBS ${EDITLINE_LIBRARY} ${NCURSES_LIBRARY})
341 ENDIF(PCRE_SUPPORT_LIBEDIT)
342
343 IF(PCRE_SUPPORT_LIBZ)
344 SET(SUPPORT_LIBZ 1)
345 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
346 ENDIF(PCRE_SUPPORT_LIBZ)
347
348 IF(PCRE_SUPPORT_LIBBZ2)
349 SET(SUPPORT_LIBBZ2 1)
350 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
351 ENDIF(PCRE_SUPPORT_LIBBZ2)
352
353 SET(NEWLINE "")
354
355 IF(PCRE_NEWLINE STREQUAL "LF")
356 SET(NEWLINE "10")
357 ENDIF(PCRE_NEWLINE STREQUAL "LF")
358 IF(PCRE_NEWLINE STREQUAL "CR")
359 SET(NEWLINE "13")
360 ENDIF(PCRE_NEWLINE STREQUAL "CR")
361 IF(PCRE_NEWLINE STREQUAL "CRLF")
362 SET(NEWLINE "3338")
363 ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
364 IF(PCRE_NEWLINE STREQUAL "ANY")
365 SET(NEWLINE "-1")
366 ENDIF(PCRE_NEWLINE STREQUAL "ANY")
367 IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
368 SET(NEWLINE "-2")
369 ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
370
371 IF(NEWLINE STREQUAL "")
372 MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
373 ENDIF(NEWLINE STREQUAL "")
374
375 IF(PCRE_EBCDIC)
376 SET(EBCDIC 1)
377 IF(PCRE_NEWLINE STREQUAL "LF")
378 SET(NEWLINE "21")
379 ENDIF(PCRE_NEWLINE STREQUAL "LF")
380 IF(PCRE_NEWLINE STREQUAL "CRLF")
381 SET(NEWLINE "3349")
382 ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
383 ENDIF(PCRE_EBCDIC)
384
385 IF(PCRE_EBCDIC_NL25)
386 SET(EBCDIC 1)
387 SET(EBCDIC_NL25 1)
388 IF(PCRE_NEWLINE STREQUAL "LF")
389 SET(NEWLINE "37")
390 ENDIF(PCRE_NEWLINE STREQUAL "LF")
391 IF(PCRE_NEWLINE STREQUAL "CRLF")
392 SET(NEWLINE "3365")
393 ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
394 ENDIF(PCRE_EBCDIC_NL25)
395
396 IF(PCRE_NO_RECURSE)
397 SET(NO_RECURSE 1)
398 ENDIF(PCRE_NO_RECURSE)
399
400 # Output files
401 CONFIGURE_FILE(config-cmake.h.in
402 ${PROJECT_BINARY_DIR}/config.h
403 @ONLY)
404
405 # Parse version numbers and date out of configure.ac
406
407 file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
408 configure_lines
409 LIMIT_COUNT 50 # Read only the first 50 lines of the file
410 )
411
412 set(SEARCHED_VARIABLES "pcre_major" "pcre_minor" "pcre_prerelease" "pcre_date")
413 foreach(configure_line ${configure_lines})
414 foreach(_substitution_variable ${SEARCHED_VARIABLES})
415 string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
416 if (NOT ${_substitution_variable_upper})
417 string(REGEX MATCH "m4_define\\(${_substitution_variable}, \\[(.*)\\]" MATCHED_STRING ${configure_line})
418 if (CMAKE_MATCH_1)
419 set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
420 endif()
421 endif()
422 endforeach()
423 endforeach()
424
425 CONFIGURE_FILE(pcre.h.in
426 ${PROJECT_BINARY_DIR}/pcre.h
427 @ONLY)
428
429 IF(PCRE_BUILD_PCRECPP)
430 CONFIGURE_FILE(pcre_stringpiece.h.in
431 ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
432 @ONLY)
433
434 CONFIGURE_FILE(pcrecpparg.h.in
435 ${PROJECT_BINARY_DIR}/pcrecpparg.h
436 @ONLY)
437 ENDIF(PCRE_BUILD_PCRECPP)
438
439 # Generate pkg-config files
440 SET(PACKAGE_VERSION "${PCRE_MAJOR}.${PCRE_MINOR}")
441 SET(prefix "${CMAKE_INSTALL_PREFIX}")
442 SET(exec_prefix "\${prefix}")
443 SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
444 SET(includedir "\${prefix}/include")
445 IF(NOT BUILD_SHARED_LIBS)
446 SET(PCRE_STATIC_CFLAG "-DPCRE_STATIC")
447 ENDIF(NOT BUILD_SHARED_LIBS)
448 # TO-DO: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
449
450 CONFIGURE_FILE(libpcreposix.pc.in ${PROJECT_BINARY_DIR}/libpcreposix.pc @ONLY)
451
452 IF(PCRE_BUILD_PCRE8)
453 CONFIGURE_FILE(libpcre.pc.in ${PROJECT_BINARY_DIR}/libpcre.pc @ONLY)
454 SET(enable_pcre8 "yes")
455 ELSE()
456 SET(enable_pcre8 "no")
457 ENDIF()
458
459 IF(PCRE_BUILD_PCRE16)
460 CONFIGURE_FILE(libpcre16.pc.in ${PROJECT_BINARY_DIR}/libpcre16.pc @ONLY)
461 SET(enable_pcre16 "yes")
462 ELSE()
463 SET(enable_pcre16 "no")
464 ENDIF()
465
466 IF(PCRE_BUILD_PCRE32)
467 CONFIGURE_FILE(libpcre32.pc.in ${PROJECT_BINARY_DIR}/libpcre32.pc @ONLY)
468 SET(enable_pcre32 "yes")
469 ELSE()
470 SET(enable_pcre32 "no")
471 ENDIF()
472
473 IF(PCRE_BUILD_PCRECPP)
474 CONFIGURE_FILE(libpcrecpp.pc.in ${PROJECT_BINARY_DIR}/libpcrecpp.pc @ONLY)
475 SET(enable_cpp "yes")
476 ELSE()
477 SET(enable_cpp "no")
478 ENDIF()
479
480 CONFIGURE_FILE(pcre-config.in pcre-config @ONLY)
481
482 # Character table generation
483
484 OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
485 IF(PCRE_REBUILD_CHARTABLES)
486 ADD_EXECUTABLE(dftables dftables.c)
487
488 GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
489
490 ADD_CUSTOM_COMMAND(
491 COMMENT "Generating character tables (pcre_chartables.c) for current locale"
492 DEPENDS dftables
493 COMMAND ${DFTABLES_EXE}
494 ARGS ${PROJECT_BINARY_DIR}/pcre_chartables.c
495 OUTPUT ${PROJECT_BINARY_DIR}/pcre_chartables.c
496 )
497 ELSE(PCRE_REBUILD_CHARTABLES)
498 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
499 ${PROJECT_BINARY_DIR}/pcre_chartables.c
500 COPYONLY)
501 ENDIF(PCRE_REBUILD_CHARTABLES)
502
503 # Source code
504
505 SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
506
507 IF(PCRE_BUILD_PCRE8)
508 SET(PCRE_SOURCES
509 pcre_byte_order.c
510 pcre_chartables.c
511 pcre_compile.c
512 pcre_config.c
513 pcre_dfa_exec.c
514 pcre_exec.c
515 pcre_fullinfo.c
516 pcre_get.c
517 pcre_globals.c
518 pcre_jit_compile.c
519 pcre_maketables.c
520 pcre_newline.c
521 pcre_ord2utf8.c
522 pcre_refcount.c
523 pcre_string_utils.c
524 pcre_study.c
525 pcre_tables.c
526 pcre_ucd.c
527 pcre_valid_utf8.c
528 pcre_version.c
529 pcre_xclass.c
530 )
531
532 SET(PCREPOSIX_HEADERS pcreposix.h)
533
534 SET(PCREPOSIX_SOURCES pcreposix.c)
535
536 ENDIF(PCRE_BUILD_PCRE8)
537
538 IF(PCRE_BUILD_PCRE16)
539 SET(PCRE16_SOURCES
540 pcre16_byte_order.c
541 pcre16_chartables.c
542 pcre16_compile.c
543 pcre16_config.c
544 pcre16_dfa_exec.c
545 pcre16_exec.c
546 pcre16_fullinfo.c
547 pcre16_get.c
548 pcre16_globals.c
549 pcre16_jit_compile.c
550 pcre16_maketables.c
551 pcre16_newline.c
552 pcre16_ord2utf16.c
553 pcre16_refcount.c
554 pcre16_string_utils.c
555 pcre16_study.c
556 pcre16_tables.c
557 pcre16_ucd.c
558 pcre16_utf16_utils.c
559 pcre16_valid_utf16.c
560 pcre16_version.c
561 pcre16_xclass.c
562 )
563 ENDIF(PCRE_BUILD_PCRE16)
564
565 IF(PCRE_BUILD_PCRE32)
566 SET(PCRE32_SOURCES
567 pcre32_byte_order.c
568 pcre32_chartables.c
569 pcre32_compile.c
570 pcre32_config.c
571 pcre32_dfa_exec.c
572 pcre32_exec.c
573 pcre32_fullinfo.c
574 pcre32_get.c
575 pcre32_globals.c
576 pcre32_jit_compile.c
577 pcre32_maketables.c
578 pcre32_newline.c
579 pcre32_ord2utf32.c
580 pcre32_refcount.c
581 pcre32_string_utils.c
582 pcre32_study.c
583 pcre32_tables.c
584 pcre32_ucd.c
585 pcre32_utf32_utils.c
586 pcre32_valid_utf32.c
587 pcre32_version.c
588 pcre32_xclass.c
589 )
590 ENDIF(PCRE_BUILD_PCRE32)
591
592 IF(MINGW AND NOT PCRE_STATIC)
593 IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
594 ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre.o
595 PRE-LINK
596 COMMAND windres ARGS pcre.rc pcre.o
597 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
598 COMMENT Using pcre coff info in mingw build)
599 SET(PCRE_SOURCES
600 ${PCRE_SOURCES} ${PROJECT_SOURCE_DIR}/pcre.o
601 )
602 ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
603 IF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
604 ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcreposix.o
605 PRE-LINK
606 COMMAND windres ARGS pcreposix.rc pcreposix.o
607 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
608 COMMENT Using pcreposix coff info in mingw build)
609 SET(PCREPOSIX_SOURCES
610 ${PCREPOSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcreposix.o
611 )
612 ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
613 ENDIF(MINGW AND NOT PCRE_STATIC)
614
615 IF(MSVC AND NOT PCRE_STATIC)
616 IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
617 SET(PCRE_SOURCES
618 ${PCRE_SOURCES} pcre.rc)
619 ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
620 IF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
621 SET(PCREPOSIX_SOURCES
622 ${PCREPOSIX_SOURCES} pcreposix.rc)
623 ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
624 ENDIF(MSVC AND NOT PCRE_STATIC)
625
626 # Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
627 # This code was taken from the CMake wiki, not from WebM.
628
629 IF(MSVC AND PCRE_STATIC_RUNTIME)
630 MESSAGE(STATUS "** MSVC and PCRE_STATIC_RUNTIME: modifying compiler flags to use static runtime library")
631 foreach(flag_var
632 CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
633 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
634 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
635 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
636 string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
637 endforeach()
638 ENDIF(MSVC AND PCRE_STATIC_RUNTIME)
639
640 SET(PCRECPP_HEADERS
641 pcrecpp.h
642 pcre_scanner.h
643 ${PROJECT_BINARY_DIR}/pcrecpparg.h
644 ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
645 )
646
647 SET(PCRECPP_SOURCES
648 pcrecpp.cc
649 pcre_scanner.cc
650 pcre_stringpiece.cc
651 )
652
653 # Build setup
654
655 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
656
657 IF(MSVC)
658 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
659 ENDIF(MSVC)
660
661 SET(CMAKE_INCLUDE_CURRENT_DIR 1)
662 # needed to make sure to not link debug libs
663 # against release libs and vice versa
664 IF(WIN32)
665 SET(CMAKE_DEBUG_POSTFIX "d")
666 ENDIF(WIN32)
667
668 SET(targets)
669
670 # Libraries
671 # pcre
672 IF(PCRE_BUILD_PCRE8)
673 ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
674 SET(targets ${targets} pcre)
675 ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
676 SET(targets ${targets} pcreposix)
677 TARGET_LINK_LIBRARIES(pcreposix pcre)
678
679 IF(MINGW AND NOT PCRE_STATIC)
680 IF(NON_STANDARD_LIB_PREFIX)
681 SET_TARGET_PROPERTIES(pcre pcreposix
682 PROPERTIES PREFIX ""
683 )
684 ENDIF(NON_STANDARD_LIB_PREFIX)
685
686 IF(NON_STANDARD_LIB_SUFFIX)
687 SET_TARGET_PROPERTIES(pcre pcreposix
688 PROPERTIES SUFFIX "-0.dll"
689 )
690 ENDIF(NON_STANDARD_LIB_SUFFIX)
691 ENDIF(MINGW AND NOT PCRE_STATIC)
692
693 ENDIF(PCRE_BUILD_PCRE8)
694
695 IF(PCRE_BUILD_PCRE16)
696 ADD_LIBRARY(pcre16 ${PCRE_HEADERS} ${PCRE16_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
697 SET(targets ${targets} pcre16)
698
699 IF(MINGW AND NOT PCRE_STATIC)
700 IF(NON_STANDARD_LIB_PREFIX)
701 SET_TARGET_PROPERTIES(pcre16
702 PROPERTIES PREFIX ""
703 )
704 ENDIF(NON_STANDARD_LIB_PREFIX)
705
706 IF(NON_STANDARD_LIB_SUFFIX)
707 SET_TARGET_PROPERTIES(pcre16
708 PROPERTIES SUFFIX "-0.dll"
709 )
710 ENDIF(NON_STANDARD_LIB_SUFFIX)
711 ENDIF(MINGW AND NOT PCRE_STATIC)
712
713 ENDIF(PCRE_BUILD_PCRE16)
714
715 IF(PCRE_BUILD_PCRE32)
716 ADD_LIBRARY(pcre32 ${PCRE_HEADERS} ${PCRE32_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
717 SET(targets ${targets} pcre32)
718
719 IF(MINGW AND NOT PCRE_STATIC)
720 IF(NON_STANDARD_LIB_PREFIX)
721 SET_TARGET_PROPERTIES(pcre32
722 PROPERTIES PREFIX ""
723 )
724 ENDIF(NON_STANDARD_LIB_PREFIX)
725
726 IF(NON_STANDARD_LIB_SUFFIX)
727 SET_TARGET_PROPERTIES(pcre32
728 PROPERTIES SUFFIX "-0.dll"
729 )
730 ENDIF(NON_STANDARD_LIB_SUFFIX)
731 ENDIF(MINGW AND NOT PCRE_STATIC)
732
733 ENDIF(PCRE_BUILD_PCRE32)
734
735 # pcrecpp
736 IF(PCRE_BUILD_PCRECPP)
737 ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
738 SET(targets ${targets} pcrecpp)
739 TARGET_LINK_LIBRARIES(pcrecpp pcre)
740
741 IF(MINGW AND NOT PCRE_STATIC)
742 IF(NON_STANDARD_LIB_PREFIX)
743 SET_TARGET_PROPERTIES(pcrecpp
744 PROPERTIES PREFIX ""
745 )
746 ENDIF(NON_STANDARD_LIB_PREFIX)
747
748 IF(NON_STANDARD_LIB_SUFFIX)
749 SET_TARGET_PROPERTIES(pcrecpp
750 PROPERTIES SUFFIX "-0.dll"
751 )
752 ENDIF(NON_STANDARD_LIB_SUFFIX)
753 ENDIF(MINGW AND NOT PCRE_STATIC)
754 ENDIF(PCRE_BUILD_PCRECPP)
755
756
757 # Executables
758
759 # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
760 # automatically, and it gave trouble in some environments anyway.
761 # ADD_EXECUTABLE(pcredemo pcredemo.c)
762 # TARGET_LINK_LIBRARIES(pcredemo pcreposix)
763 # IF(NOT BUILD_SHARED_LIBS)
764 # # make sure to not use declspec(dllimport) in static mode on windows
765 # SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
766 # ENDIF(NOT BUILD_SHARED_LIBS)
767
768 IF(PCRE_BUILD_PCREGREP)
769 ADD_EXECUTABLE(pcregrep pcregrep.c)
770 SET(targets ${targets} pcregrep)
771 TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
772 ENDIF(PCRE_BUILD_PCREGREP)
773
774 # Testing
775 IF(PCRE_BUILD_TESTS)
776 ENABLE_TESTING()
777
778 SET(PCRETEST_SOURCES pcretest.c)
779 IF(PCRE_BUILD_PCRE8)
780 LIST(APPEND PCRETEST_SOURCES pcre_printint.c)
781 ENDIF(PCRE_BUILD_PCRE8)
782 IF(PCRE_BUILD_PCRE16)
783 LIST(APPEND PCRETEST_SOURCES pcre16_printint.c)
784 ENDIF(PCRE_BUILD_PCRE16)
785 IF(PCRE_BUILD_PCRE32)
786 LIST(APPEND PCRETEST_SOURCES pcre32_printint.c)
787 ENDIF(PCRE_BUILD_PCRE32)
788
789 ADD_EXECUTABLE(pcretest ${PCRETEST_SOURCES})
790 SET(targets ${targets} pcretest)
791 IF(PCRE_BUILD_PCRE8)
792 LIST(APPEND PCRETEST_LIBS pcreposix pcre)
793 ENDIF(PCRE_BUILD_PCRE8)
794 IF(PCRE_BUILD_PCRE16)
795 LIST(APPEND PCRETEST_LIBS pcre16)
796 ENDIF(PCRE_BUILD_PCRE16)
797 IF(PCRE_BUILD_PCRE32)
798 LIST(APPEND PCRETEST_LIBS pcre32)
799 ENDIF(PCRE_BUILD_PCRE32)
800 TARGET_LINK_LIBRARIES(pcretest ${PCRETEST_LIBS})
801
802 IF(PCRE_SUPPORT_JIT)
803 ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
804 SET(targets ${targets} pcre_jit_test)
805 SET(PCRE_JIT_TEST_LIBS )
806 IF(PCRE_BUILD_PCRE8)
807 LIST(APPEND PCRE_JIT_TEST_LIBS pcre)
808 ENDIF(PCRE_BUILD_PCRE8)
809 IF(PCRE_BUILD_PCRE16)
810 LIST(APPEND PCRE_JIT_TEST_LIBS pcre16)
811 ENDIF(PCRE_BUILD_PCRE16)
812 IF(PCRE_BUILD_PCRE32)
813 LIST(APPEND PCRE_JIT_TEST_LIBS pcre32)
814 ENDIF(PCRE_BUILD_PCRE32)
815 TARGET_LINK_LIBRARIES(pcre_jit_test ${PCRE_JIT_TEST_LIBS})
816 ENDIF(PCRE_SUPPORT_JIT)
817
818 IF(PCRE_BUILD_PCRECPP)
819 ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
820 SET(targets ${targets} pcrecpp_unittest)
821 TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
822 IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
823 SET_TARGET_PROPERTIES(pcrecpp
824 PROPERTIES PREFIX ""
825 )
826 ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
827
828 ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
829 SET(targets ${targets} pcre_scanner_unittest)
830 TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
831
832 ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
833 SET(targets ${targets} pcre_stringpiece_unittest)
834 TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
835 ENDIF(PCRE_BUILD_PCRECPP)
836
837 # exes in Debug location tested by the RunTest shell script
838 # via "make test"
839 IF(PCRE_BUILD_PCREGREP)
840 GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
841 ENDIF(PCRE_BUILD_PCREGREP)
842
843 GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
844
845 # =================================================
846 # Write out a CTest configuration file
847 #
848 FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
849 "# This is a generated file.
850 MESSAGE(\"When testing is complete, review test output in the
851 \\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
852 MESSAGE(\" \")
853 ")
854
855 FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
856 "#! /bin/sh
857 # This is a generated file.
858 srcdir=${PROJECT_SOURCE_DIR}
859 pcretest=${PCRETEST_EXE}
860 . ${PROJECT_SOURCE_DIR}/RunTest
861 if test \"$?\" != \"0\"; then exit 1; fi
862 # End
863 ")
864
865 IF(UNIX)
866 ADD_TEST(pcre_test sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
867 ENDIF(UNIX)
868
869 IF(PCRE_BUILD_PCREGREP)
870 FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
871 "#! /bin/sh
872 # This is a generated file.
873 srcdir=${PROJECT_SOURCE_DIR}
874 pcregrep=${PCREGREP_EXE}
875 pcretest=${PCRETEST_EXE}
876 . ${PROJECT_SOURCE_DIR}/RunGrepTest
877 if test \"$?\" != \"0\"; then exit 1; fi
878 # End
879 ")
880
881 IF(UNIX)
882 ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
883 ENDIF(UNIX)
884 ENDIF(PCRE_BUILD_PCREGREP)
885
886 IF(WIN32)
887 # Provide environment for executing the bat file version of RunTest
888 FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
889 FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)
890 FILE(TO_NATIVE_PATH ${PCRETEST_EXE} winexe)
891
892 FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.bat
893 "\@REM This is a generated file.
894 \@echo off
895 setlocal
896 SET srcdir=\"${winsrc}\"
897 SET pcretest=\"${winexe}\"
898 if not [%CMAKE_CONFIG_TYPE%]==[] SET pcretest=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcretest.exe\"
899 call %srcdir%\\RunTest.Bat
900 if errorlevel 1 exit /b 1
901 echo RunTest.bat tests successfully completed
902 ")
903
904 ADD_TEST(NAME pcre_test_bat
905 COMMAND pcre_test.bat)
906 SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
907 PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
908
909 IF("$ENV{OSTYPE}" STREQUAL "msys")
910 # Both the sh and bat file versions of RunTest are run if make test is used
911 # in msys
912 ADD_TEST(pcre_test_sh sh.exe ${PROJECT_BINARY_DIR}/pcre_test.sh)
913 IF(PCRE_BUILD_PCREGREP)
914 ADD_TEST(pcre_grep_test sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
915 ENDIF(PCRE_BUILD_PCREGREP)
916 ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
917
918 ENDIF(WIN32)
919
920 # Changed to accommodate testing whichever location was just built
921
922 IF(PCRE_SUPPORT_JIT)
923 ADD_TEST(pcre_jit_test pcre_jit_test)
924 ENDIF(PCRE_SUPPORT_JIT)
925
926 IF(PCRE_BUILD_PCRECPP)
927 ADD_TEST(pcrecpp_test pcrecpp_unittest)
928 ADD_TEST(pcre_scanner_test pcre_scanner_unittest)
929 ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
930 ENDIF(PCRE_BUILD_PCRECPP)
931
932 ENDIF(PCRE_BUILD_TESTS)
933
934 # Installation
935 SET(CMAKE_INSTALL_ALWAYS 1)
936
937 INSTALL(TARGETS ${targets}
938 RUNTIME DESTINATION bin
939 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
940 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
941
942 INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
943
944 FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
945 FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
946 FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
947 FILE(GLOB pc ${PROJECT_BINARY_DIR}/*.pc)
948
949 IF(PCRE_BUILD_PCRECPP)
950 INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
951 ELSE(PCRE_BUILD_PCRECPP)
952 # Remove pcrecpp.3
953 FOREACH(man ${man3})
954 GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
955 IF(NOT man_tmp STREQUAL "pcrecpp.3")
956 SET(man3_new ${man3} ${man})
957 ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
958 ENDFOREACH(man ${man3})
959 SET(man3 ${man3_new})
960 ENDIF(PCRE_BUILD_PCRECPP)
961
962 INSTALL(FILES ${man1} DESTINATION man/man1)
963 INSTALL(FILES ${man3} DESTINATION man/man3)
964 INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
965 INSTALL(FILES ${pc} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
966 INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/pcre-config"
967 DESTINATION bin
968 # Set 0755 permissions
969 PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
970
971 IF(MSVC AND INSTALL_MSVC_PDB)
972 INSTALL(FILES ${PROJECT_BINARY_DIR}/pcre.pdb
973 ${PROJECT_BINARY_DIR}/pcreposix.pdb
974 DESTINATION bin
975 CONFIGURATIONS RelWithDebInfo)
976 INSTALL(FILES ${PROJECT_BINARY_DIR}/pcred.pdb
977 ${PROJECT_BINARY_DIR}/pcreposixd.pdb
978 DESTINATION bin
979 CONFIGURATIONS Debug)
980 ENDIF(MSVC AND INSTALL_MSVC_PDB)
981
982 # help, only for nice output
983 IF(BUILD_SHARED_LIBS)
984 SET(BUILD_STATIC_LIBS OFF)
985 ELSE(BUILD_SHARED_LIBS)
986 SET(BUILD_STATIC_LIBS ON)
987 ENDIF(BUILD_SHARED_LIBS)
988
989 IF(PCRE_SHOW_REPORT)
990 STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
991 IF (CMAKE_C_FLAGS)
992 SET(cfsp " ")
993 ENDIF(CMAKE_C_FLAGS)
994 IF (CMAKE_CXX_FLAGS)
995 SET(cxxfsp " ")
996 ENDIF(CMAKE_CXX_FLAGS)
997 MESSAGE(STATUS "")
998 MESSAGE(STATUS "")
999 MESSAGE(STATUS "PCRE-${PCRE_MAJOR}.${PCRE_MINOR} configuration summary:")
1000 MESSAGE(STATUS "")
1001 MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
1002 MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
1003 MESSAGE(STATUS " C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
1004 MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
1005 MESSAGE(STATUS " C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
1006 MESSAGE(STATUS "")
1007 MESSAGE(STATUS " Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
1008 MESSAGE(STATUS " Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
1009 MESSAGE(STATUS " Build 32 bit PCRE library ....... : ${PCRE_BUILD_PCRE32}")
1010 MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
1011 MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
1012 MESSAGE(STATUS " Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
1013 MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
1014 MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}")
1015 MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
1016 MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE_EBCDIC}")
1017 MESSAGE(STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE_EBCDIC_NL25}")
1018 MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
1019 MESSAGE(STATUS " No stack recursion .............. : ${PCRE_NO_RECURSE}")
1020 MESSAGE(STATUS " POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
1021 MESSAGE(STATUS " Internal link size .............. : ${PCRE_LINK_SIZE}")
1022 MESSAGE(STATUS " Parentheses nest limit .......... : ${PCRE_PARENS_NEST_LIMIT}")
1023 MESSAGE(STATUS " Match limit ..................... : ${PCRE_MATCH_LIMIT}")
1024 MESSAGE(STATUS " Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
1025 MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}")
1026 MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}")
1027 MESSAGE(STATUS " Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
1028 MESSAGE(STATUS " Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
1029 MESSAGE(STATUS " Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
1030 MESSAGE(STATUS " Build tests (implies pcretest .. : ${PCRE_BUILD_TESTS}")
1031 MESSAGE(STATUS " and pcregrep)")
1032 IF(ZLIB_FOUND)
1033 MESSAGE(STATUS " Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
1034 ELSE(ZLIB_FOUND)
1035 MESSAGE(STATUS " Link pcregrep with libz ......... : Library not found" )
1036 ENDIF(ZLIB_FOUND)
1037 IF(BZIP2_FOUND)
1038 MESSAGE(STATUS " Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
1039 ELSE(BZIP2_FOUND)
1040 MESSAGE(STATUS " Link pcregrep with libbz2 ....... : Library not found" )
1041 ENDIF(BZIP2_FOUND)
1042 IF(EDITLINE_FOUND)
1043 MESSAGE(STATUS " Link pcretest with libeditline .. : ${PCRE_SUPPORT_LIBEDIT}")
1044 ELSE(EDITLINE_FOUND)
1045 MESSAGE(STATUS " Link pcretest with libeditline .. : Library not found" )
1046 ENDIF(EDITLINE_FOUND)
1047 IF(READLINE_FOUND)
1048 MESSAGE(STATUS " Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
1049 ELSE(READLINE_FOUND)
1050 MESSAGE(STATUS " Link pcretest with libreadline .. : Library not found" )
1051 ENDIF(READLINE_FOUND)
1052 MESSAGE(STATUS " Support Valgrind .................: ${PCRE_SUPPORT_VALGRIND}")
1053 MESSAGE(STATUS " Support coverage .................: ${PCRE_SUPPORT_COVERAGE}")
1054
1055 IF(MINGW AND NOT PCRE_STATIC)
1056 MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
1057 MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
1058 ENDIF(MINGW AND NOT PCRE_STATIC)
1059
1060 IF(MSVC)
1061 MESSAGE(STATUS " Install MSVC .pdb files ..........: ${INSTALL_MSVC_PDB}")
1062 ENDIF(MSVC)
1063
1064 MESSAGE(STATUS "")
1065 ENDIF(PCRE_SHOW_REPORT)
1066
1067 # end CMakeLists.txt

  ViewVC Help
Powered by ViewVC 1.1.5