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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 667 - (hide annotations) (download)
Mon Aug 22 14:57:32 2011 UTC (3 years, 3 months ago) by ph10
File MIME type: text/plain
File size: 20768 byte(s)
Commit all the changes for JIT support, but without any documentation yet.

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 137
43     PROJECT(PCRE C CXX)
44    
45     CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
46    
47 ph10 405 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
48 ph10 303
49     # external packages
50     FIND_PACKAGE( BZip2 )
51     FIND_PACKAGE( ZLIB )
52     FIND_PACKAGE( Readline )
53    
54 ph10 137 # Configuration checks
55    
56     INCLUDE(CheckIncludeFile)
57     INCLUDE(CheckIncludeFileCXX)
58     INCLUDE(CheckFunctionExists)
59     INCLUDE(CheckTypeSize)
60    
61 ph10 318 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
62 ph10 475 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
63 ph10 495 CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
64 ph10 318 CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
65     CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
66     CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
67     CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
68 ph10 137
69 ph10 318 CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H)
70     CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H)
71 ph10 137
72 ph10 318 CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY)
73     CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
74     CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
75     CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL)
76     CHECK_FUNCTION_EXISTS(strtoq HAVE_STRTOQ)
77 ph10 303 CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
78 ph10 137
79 ph10 318 CHECK_TYPE_SIZE("long long" LONG_LONG)
80     CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
81 ph10 137
82     # User-configurable options
83     #
84     # (Note: CMakeSetup displays these in alphabetical order, regardless of
85     # the order we use here)
86    
87 ph10 144 SET(BUILD_SHARED_LIBS OFF CACHE BOOL
88     "Build shared libraries instead of static ones.")
89 ph10 137
90     OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
91    
92 ph10 144 SET(PCRE_EBCDIC OFF CACHE BOOL
93 ph10 137 "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)")
94    
95     SET(PCRE_LINK_SIZE "2" CACHE STRING
96     "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
97    
98     SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING
99     "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
100    
101     SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
102     "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
103    
104 ph10 650 SET(PCREGREP_BUFSIZE "20480" CACHE STRING
105     "Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
106    
107 ph10 137 SET(PCRE_NEWLINE "LF" CACHE STRING
108 ph10 258 "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
109 ph10 137
110 ph10 199 SET(PCRE_NO_RECURSE OFF CACHE BOOL
111 ph10 137 "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.")
112    
113     SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
114     "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
115    
116 ph10 667 SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
117     "Enable support for Just-in-time compiling.")
118    
119 ph10 144 SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
120 ph10 137 "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")
121    
122 ph10 144 SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
123 ph10 137 "Enable support for the Unicode UTF-8 encoding.")
124    
125 ph10 258 SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
126     "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
127    
128 ph10 407 OPTION(PCRE_SHOW_REPORT "Show the final configuration report" ON)
129     OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
130     OPTION(PCRE_BUILD_TESTS "Build the tests" ON)
131 ph10 311
132 ph10 407 IF (PCRE_BUILD_TESTS)
133     IF (NOT PCRE_BUILD_PCREGREP)
134 ph10 411 MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")
135 ph10 407 SET(PCRE_BUILD_PCREGREP ON)
136 ph10 411 ENDIF(NOT PCRE_BUILD_PCREGREP)
137     ENDIF(PCRE_BUILD_TESTS)
138 ph10 407
139 ph10 318 IF (MINGW)
140     OPTION(NON_STANDARD_LIB_PREFIX
141     "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
142     OFF)
143 ph10 311
144 ph10 318 OPTION(NON_STANDARD_LIB_SUFFIX
145     "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
146     OFF)
147     ENDIF(MINGW)
148    
149 ph10 303 # bzip2 lib
150     IF(BZIP2_FOUND)
151     OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON)
152     ENDIF(BZIP2_FOUND)
153     IF(PCRE_SUPPORT_LIBBZ2)
154     INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
155     ENDIF(PCRE_SUPPORT_LIBBZ2)
156 ph10 292
157 ph10 303 # zlib
158     IF(ZLIB_FOUND)
159     OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON)
160     ENDIF(ZLIB_FOUND)
161     IF(PCRE_SUPPORT_LIBZ)
162     INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
163     ENDIF(PCRE_SUPPORT_LIBZ)
164 ph10 292
165 ph10 303 # readline lib
166     IF(READLINE_FOUND)
167     OPTION (PCRE_SUPPORT_LIBREADLINE "Enable support for linking pcretest with libreadline." ON)
168     ENDIF(READLINE_FOUND)
169     IF(PCRE_SUPPORT_LIBREADLINE)
170     INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
171     ENDIF(PCRE_SUPPORT_LIBREADLINE)
172 ph10 291
173 ph10 137 # Prepare build configuration
174    
175     SET(pcre_have_type_traits 0)
176     SET(pcre_have_bits_type_traits 0)
177    
178     IF(HAVE_TYPE_TRAITS_H)
179 ph10 318 SET(pcre_have_type_traits 1)
180 ph10 137 ENDIF(HAVE_TYPE_TRAITS_H)
181    
182     IF(HAVE_BITS_TYPE_TRAITS_H)
183 ph10 318 SET(pcre_have_bits_type_traits 1)
184 ph10 137 ENDIF(HAVE_BITS_TYPE_TRAITS_H)
185    
186     SET(pcre_have_long_long 0)
187     SET(pcre_have_ulong_long 0)
188    
189     IF(HAVE_LONG_LONG)
190 ph10 318 SET(pcre_have_long_long 1)
191 ph10 137 ENDIF(HAVE_LONG_LONG)
192    
193     IF(HAVE_UNSIGNED_LONG_LONG)
194 ph10 318 SET(pcre_have_ulong_long 1)
195 ph10 137 ENDIF(HAVE_UNSIGNED_LONG_LONG)
196    
197 ph10 144 IF(NOT BUILD_SHARED_LIBS)
198 ph10 318 SET(PCRE_STATIC 1)
199 ph10 144 ENDIF(NOT BUILD_SHARED_LIBS)
200    
201 ph10 258 IF(PCRE_SUPPORT_BSR_ANYCRLF)
202 ph10 318 SET(BSR_ANYCRLF 1)
203 ph10 258 ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
204    
205 ph10 137 IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
206 ph10 318 SET(SUPPORT_UTF8 1)
207 ph10 137 ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
208    
209     IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
210 ph10 318 SET(SUPPORT_UCP 1)
211 ph10 137 ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
212    
213 ph10 667 IF(PCRE_SUPPORT_JIT)
214     SET(SUPPORT_JIT 1)
215     ENDIF(PCRE_SUPPORT_JIT)
216    
217 ph10 344 # This next one used to contain
218     # SET(PCRETEST_LIBS ${READLINE_LIBRARY})
219     # but I was advised to add the NCURSES test as well, along with
220     # some modifications to cmake/FindReadline.cmake which should
221     # make it possible to override the default if necessary. PH
222    
223 ph10 291 IF(PCRE_SUPPORT_LIBREADLINE)
224     SET(SUPPORT_LIBREADLINE 1)
225 ph10 344 SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
226 ph10 291 ENDIF(PCRE_SUPPORT_LIBREADLINE)
227    
228     IF(PCRE_SUPPORT_LIBZ)
229     SET(SUPPORT_LIBZ 1)
230 ph10 303 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
231 ph10 291 ENDIF(PCRE_SUPPORT_LIBZ)
232    
233     IF(PCRE_SUPPORT_LIBBZ2)
234     SET(SUPPORT_LIBBZ2 1)
235 ph10 303 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
236 ph10 292 ENDIF(PCRE_SUPPORT_LIBBZ2)
237 ph10 291
238 ph10 144 SET(NEWLINE "")
239    
240 ph10 137 IF(PCRE_NEWLINE STREQUAL "LF")
241 ph10 318 SET(NEWLINE "10")
242 ph10 144 ENDIF(PCRE_NEWLINE STREQUAL "LF")
243     IF(PCRE_NEWLINE STREQUAL "CR")
244 ph10 318 SET(NEWLINE "13")
245 ph10 144 ENDIF(PCRE_NEWLINE STREQUAL "CR")
246     IF(PCRE_NEWLINE STREQUAL "CRLF")
247 ph10 318 SET(NEWLINE "3338")
248 ph10 144 ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
249     IF(PCRE_NEWLINE STREQUAL "ANY")
250 ph10 318 SET(NEWLINE "-1")
251 ph10 144 ENDIF(PCRE_NEWLINE STREQUAL "ANY")
252 ph10 258 IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
253 ph10 318 SET(NEWLINE "-2")
254 ph10 258 ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
255 ph10 144
256     IF(NEWLINE STREQUAL "")
257 ph10 318 MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
258 ph10 144 ENDIF(NEWLINE STREQUAL "")
259 ph10 137
260     IF(PCRE_EBCDIC)
261 ph10 318 SET(EBCDIC 1)
262 ph10 137 ENDIF(PCRE_EBCDIC)
263    
264     IF(PCRE_NO_RECURSE)
265 ph10 318 SET(NO_RECURSE 1)
266 ph10 137 ENDIF(PCRE_NO_RECURSE)
267    
268     # Output files
269     CONFIGURE_FILE(config-cmake.h.in
270 ph10 405 ${PROJECT_BINARY_DIR}/config.h
271 ph10 137 @ONLY)
272    
273     CONFIGURE_FILE(pcre.h.generic
274 ph10 405 ${PROJECT_BINARY_DIR}/pcre.h
275 ph10 137 COPYONLY)
276    
277     # What about pcre-config and libpcre.pc?
278    
279     IF(PCRE_BUILD_PCRECPP)
280 ph10 318 CONFIGURE_FILE(pcre_stringpiece.h.in
281 ph10 405 ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
282 ph10 318 @ONLY)
283 ph10 137
284 ph10 318 CONFIGURE_FILE(pcrecpparg.h.in
285 ph10 405 ${PROJECT_BINARY_DIR}/pcrecpparg.h
286 ph10 318 @ONLY)
287 ph10 137 ENDIF(PCRE_BUILD_PCRECPP)
288    
289     # Character table generation
290    
291 ph10 303 OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
292     IF(PCRE_REBUILD_CHARTABLES)
293     ADD_EXECUTABLE(dftables dftables.c)
294 ph10 137
295 ph10 303 GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
296 ph10 137
297 ph10 303 ADD_CUSTOM_COMMAND(
298     COMMENT "Generating character tables (pcre_chartables.c) for current locale"
299     DEPENDS dftables
300     COMMAND ${DFTABLES_EXE}
301 ph10 405 ARGS ${PROJECT_BINARY_DIR}/pcre_chartables.c
302     OUTPUT ${PROJECT_BINARY_DIR}/pcre_chartables.c
303 ph10 303 )
304     ELSE(PCRE_REBUILD_CHARTABLES)
305 ph10 405 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
306     ${PROJECT_BINARY_DIR}/pcre_chartables.c
307 ph10 303 COPYONLY)
308     ENDIF(PCRE_REBUILD_CHARTABLES)
309 ph10 137
310     # Source code
311    
312 ph10 405 SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
313 ph10 137
314     SET(PCRE_SOURCES
315 ph10 405 ${PROJECT_BINARY_DIR}/pcre_chartables.c
316 ph10 303 pcre_compile.c
317     pcre_config.c
318     pcre_dfa_exec.c
319     pcre_exec.c
320     pcre_fullinfo.c
321     pcre_get.c
322     pcre_globals.c
323     pcre_info.c
324 ph10 667 pcre_jit_compile.c
325 ph10 303 pcre_newline.c
326     pcre_maketables.c
327     pcre_ord2utf8.c
328     pcre_refcount.c
329     pcre_study.c
330     pcre_tables.c
331     pcre_try_flipped.c
332 ph10 351 pcre_ucd.c
333 ph10 303 pcre_valid_utf8.c
334     pcre_version.c
335     pcre_xclass.c
336 ph10 137 )
337    
338     SET(PCREPOSIX_HEADERS pcreposix.h)
339    
340     SET(PCREPOSIX_SOURCES pcreposix.c)
341    
342     SET(PCRECPP_HEADERS
343 ph10 303 pcrecpp.h
344     pcre_scanner.h
345 ph10 405 ${PROJECT_BINARY_DIR}/pcrecpparg.h
346     ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
347 ph10 137 )
348    
349     SET(PCRECPP_SOURCES
350 ph10 318 pcrecpp.cc
351     pcre_scanner.cc
352     pcre_stringpiece.cc
353 ph10 137 )
354    
355     # Build setup
356    
357     ADD_DEFINITIONS(-DHAVE_CONFIG_H)
358    
359 ph10 303 IF(MSVC)
360 ph10 318 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
361 ph10 303 ENDIF(MSVC)
362 ph10 137
363     SET(CMAKE_INCLUDE_CURRENT_DIR 1)
364 ph10 303 # needed to make sure to not link debug libs
365     # against release libs and vice versa
366     IF(WIN32)
367     SET(CMAKE_DEBUG_POSTFIX "d")
368     ENDIF(WIN32)
369 ph10 137
370 ph10 407 SET(targets)
371    
372 ph10 137 # Libraries
373 ph10 318 # pcre
374 ph10 405 ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
375 ph10 407 SET(targets ${targets} pcre)
376 ph10 137 ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
377 ph10 407 SET(targets ${targets} pcreposix)
378 ph10 137 TARGET_LINK_LIBRARIES(pcreposix pcre)
379 ph10 318 IF(MINGW AND NOT PCRE_STATIC)
380     IF(NON_STANDARD_LIB_PREFIX)
381     SET_TARGET_PROPERTIES(pcre pcreposix
382 ph10 311 PROPERTIES PREFIX ""
383 ph10 318 )
384     ENDIF(NON_STANDARD_LIB_PREFIX)
385 ph10 311
386 ph10 318 IF(NON_STANDARD_LIB_SUFFIX)
387     SET_TARGET_PROPERTIES(pcre pcreposix
388 ph10 311 PROPERTIES SUFFIX "-0.dll"
389 ph10 318 )
390     ENDIF(NON_STANDARD_LIB_SUFFIX)
391     ENDIF(MINGW AND NOT PCRE_STATIC)
392 ph10 311
393 ph10 318
394     # pcrecpp
395 ph10 137 IF(PCRE_BUILD_PCRECPP)
396 ph10 303 ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
397 ph10 407 SET(targets ${targets} pcrecpp)
398 ph10 303 TARGET_LINK_LIBRARIES(pcrecpp pcre)
399 ph10 311
400 ph10 318 IF(MINGW AND NOT PCRE_STATIC)
401     IF(NON_STANDARD_LIB_PREFIX)
402     SET_TARGET_PROPERTIES(pcrecpp
403     PROPERTIES PREFIX ""
404     )
405     ENDIF(NON_STANDARD_LIB_PREFIX)
406    
407     IF(NON_STANDARD_LIB_SUFFIX)
408     SET_TARGET_PROPERTIES(pcrecpp
409     PROPERTIES SUFFIX "-0.dll"
410     )
411     ENDIF(NON_STANDARD_LIB_SUFFIX)
412     ENDIF(MINGW AND NOT PCRE_STATIC)
413 ph10 137 ENDIF(PCRE_BUILD_PCRECPP)
414    
415 ph10 318
416 ph10 137 # Executables
417    
418 ph10 312 # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
419     # automatically, and it gave trouble in some environments anyway.
420     # ADD_EXECUTABLE(pcredemo pcredemo.c)
421     # TARGET_LINK_LIBRARIES(pcredemo pcreposix)
422     # IF(NOT BUILD_SHARED_LIBS)
423     # # make sure to not use declspec(dllimport) in static mode on windows
424 ph10 318 # SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
425 ph10 312 # ENDIF(NOT BUILD_SHARED_LIBS)
426 ph10 303
427 ph10 407 IF(PCRE_BUILD_PCREGREP)
428     ADD_EXECUTABLE(pcregrep pcregrep.c)
429     SET(targets ${targets} pcregrep)
430     TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
431     ENDIF(PCRE_BUILD_PCREGREP)
432 ph10 144
433 ph10 311
434 ph10 407 # Testing
435     IF(PCRE_BUILD_TESTS)
436     ENABLE_TESTING()
437 ph10 144
438 ph10 407 ADD_EXECUTABLE(pcretest pcretest.c)
439     SET(targets ${targets} pcretest)
440     TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
441 ph10 667
442     IF(PCRE_SUPPORT_JIT)
443     ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
444     SET(targets ${targets} pcre_jit_test)
445     TARGET_LINK_LIBRARIES(pcre_jit_test pcre)
446     ENDIF(PCRE_SUPPORT_JIT)
447 ph10 144
448 ph10 407 IF(PCRE_BUILD_PCRECPP)
449     ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
450     SET(targets ${targets} pcrecpp_unittest)
451     TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
452     IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
453     SET_TARGET_PROPERTIES(pcrecpp
454     PROPERTIES PREFIX ""
455     )
456     ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
457 ph10 137
458 ph10 407 ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
459     SET(targets ${targets} pcre_scanner_unittest)
460     TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
461 ph10 144
462 ph10 407 ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
463     SET(targets ${targets} pcre_stringpiece_unittest)
464     TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
465     ENDIF(PCRE_BUILD_PCRECPP)
466 ph10 144
467 ph10 407 GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
468     GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
469 ph10 137
470 ph10 407 # Write out a CTest configuration file that sets some needed environment
471     # variables for the test scripts.
472     #
473     FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
474     "# This is a generated file.
475     SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})
476     SET(ENV{pcregrep} ${PCREGREP_EXE})
477     SET(ENV{pcretest} ${PCRETEST_EXE})
478     ")
479 ph10 144
480 ph10 407 IF(UNIX)
481     ADD_TEST(pcre_test ${PROJECT_SOURCE_DIR}/RunTest)
482     ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)
483     ENDIF(UNIX)
484     IF(WIN32)
485     ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)
486     ENDIF(WIN32)
487 ph10 144
488 ph10 667 IF(PCRE_SUPPORT_JIT)
489     GET_TARGET_PROPERTY(PCRE_JIT_TEST_EXE
490     pcre_jit_test
491     DEBUG_LOCATION)
492     ENDIF(PCRE_SUPPORT_JIT)
493    
494 ph10 407 GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
495     pcrecpp_unittest
496     DEBUG_LOCATION)
497 ph10 144
498 ph10 407 GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
499     pcre_scanner_unittest
500     DEBUG_LOCATION)
501 ph10 144
502 ph10 407 GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
503     pcre_stringpiece_unittest
504     DEBUG_LOCATION)
505    
506 ph10 667 IF(PCRE_SUPPORT_JIT)
507     ADD_TEST(pcre_jit_test ${PCRE_JIT_TEST_EXE})
508     ENDIF(PCRE_SUPPORT_JIT)
509 ph10 407 ADD_TEST(pcrecpp_test ${PCRECPP_UNITTEST_EXE})
510     ADD_TEST(pcre_scanner_test ${PCRE_SCANNER_UNITTEST_EXE})
511     ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})
512     ENDIF(PCRE_BUILD_TESTS)
513    
514 ph10 137 # Installation
515     SET(CMAKE_INSTALL_ALWAYS 1)
516    
517 ph10 407 INSTALL(TARGETS ${targets}
518 ph10 137 RUNTIME DESTINATION bin
519     LIBRARY DESTINATION lib
520     ARCHIVE DESTINATION lib)
521    
522     INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
523    
524 ph10 405 FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
525     FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
526     FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
527 ph10 137
528     IF(PCRE_BUILD_PCRECPP)
529 ph10 318 INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
530 ph10 137 ELSE(PCRE_BUILD_PCRECPP)
531 ph10 318 # Remove pcrecpp.3
532     FOREACH(man ${man3})
533     GET_FILENAME_COMPONENT(man_tmp ${man} NAME)
534     IF(NOT man_tmp STREQUAL "pcrecpp.3")
535     SET(man3_new ${man3} ${man})
536     ENDIF(NOT man_tmp STREQUAL "pcrecpp.3")
537     ENDFOREACH(man ${man3})
538     SET(man3 ${man3_new})
539 ph10 137 ENDIF(PCRE_BUILD_PCRECPP)
540    
541 ph10 311
542 ph10 137 INSTALL(FILES ${man1} DESTINATION man/man1)
543     INSTALL(FILES ${man3} DESTINATION man/man3)
544 ph10 199 INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
545 ph10 137
546 ph10 303 # help, only for nice output
547     IF(BUILD_SHARED_LIBS)
548     SET(BUILD_STATIC_LIBS OFF)
549     ELSE(BUILD_SHARED_LIBS)
550     SET(BUILD_STATIC_LIBS ON)
551     ENDIF(BUILD_SHARED_LIBS)
552    
553 ph10 407 IF(PCRE_SHOW_REPORT)
554 ph10 414 STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
555 ph10 413 IF (CMAKE_C_FLAGS)
556     SET(cfsp " ")
557 ph10 416 ENDIF(CMAKE_C_FLAGS)
558 ph10 413 IF (CMAKE_CXX_FLAGS)
559     SET(cxxfsp " ")
560 ph10 416 ENDIF(CMAKE_CXX_FLAGS)
561 ph10 407 MESSAGE(STATUS "")
562     MESSAGE(STATUS "")
563     MESSAGE(STATUS "PCRE configuration summary:")
564     MESSAGE(STATUS "")
565 ph10 413 MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
566     MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
567     MESSAGE(STATUS " C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
568     MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
569     MESSAGE(STATUS " C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
570 ph10 407 MESSAGE(STATUS "")
571 ph10 413 MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
572 ph10 667 MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
573 ph10 413 MESSAGE(STATUS " Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
574     MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
575     MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}")
576     MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
577     MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE_EBCDIC}")
578     MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
579     MESSAGE(STATUS " No stack recursion .............. : ${PCRE_NO_RECURSE}")
580     MESSAGE(STATUS " POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
581     MESSAGE(STATUS " Internal link size .............. : ${PCRE_LINK_SIZE}")
582     MESSAGE(STATUS " Match limit ..................... : ${PCRE_MATCH_LIMIT}")
583     MESSAGE(STATUS " Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
584     MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}")
585     MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}")
586     MESSAGE(STATUS " Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
587 ph10 655 MESSAGE(STATUS " Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
588 ph10 413 MESSAGE(STATUS " Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}")
589 ph10 407 IF(ZLIB_FOUND)
590 ph10 413 MESSAGE(STATUS " Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
591 ph10 407 ELSE(ZLIB_FOUND)
592     MESSAGE(STATUS " Link pcregrep with libz ......... : None" )
593     ENDIF(ZLIB_FOUND)
594     IF(BZIP2_FOUND)
595 ph10 413 MESSAGE(STATUS " Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
596 ph10 407 ELSE(BZIP2_FOUND)
597     MESSAGE(STATUS " Link pcregrep with libbz2 ....... : None" )
598     ENDIF(BZIP2_FOUND)
599     IF(NOT PCRE_SUPPORT_LIBREADLINE)
600     MESSAGE(STATUS " Link pcretest with libreadline .. : None" )
601     ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
602 ph10 413 MESSAGE(STATUS " Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
603 ph10 407 ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
604     IF(MINGW AND NOT PCRE_STATIC)
605 ph10 413 MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
606     MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
607 ph10 407 ENDIF(MINGW AND NOT PCRE_STATIC)
608     MESSAGE(STATUS "")
609     ENDIF(PCRE_SHOW_REPORT)
610 ph10 303
611 ph10 137 # end CMakeLists.txt

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12