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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1407 - (hide annotations) (download)
Sun Dec 1 16:31:40 2013 UTC (10 months, 4 weeks ago) by ph10
File MIME type: text/plain
File size: 33105 byte(s)
Add Jeff Trawick's patch to CMakeLists.txt for MSVC features.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12