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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 667 - (show annotations) (download)
Mon Aug 22 14:57:32 2011 UTC (2 years, 7 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 # 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
43 PROJECT(PCRE C CXX)
44
45 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)
46
47 SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
48
49 # external packages
50 FIND_PACKAGE( BZip2 )
51 FIND_PACKAGE( ZLIB )
52 FIND_PACKAGE( Readline )
53
54 # Configuration checks
55
56 INCLUDE(CheckIncludeFile)
57 INCLUDE(CheckIncludeFileCXX)
58 INCLUDE(CheckFunctionExists)
59 INCLUDE(CheckTypeSize)
60
61 CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
62 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
63 CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
64 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
69 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
72 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 CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64)
78
79 CHECK_TYPE_SIZE("long long" LONG_LONG)
80 CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
81
82 # User-configurable options
83 #
84 # (Note: CMakeSetup displays these in alphabetical order, regardless of
85 # the order we use here)
86
87 SET(BUILD_SHARED_LIBS OFF CACHE BOOL
88 "Build shared libraries instead of static ones.")
89
90 OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
91
92 SET(PCRE_EBCDIC OFF CACHE BOOL
93 "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 SET(PCREGREP_BUFSIZE "20480" CACHE STRING
105 "Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
106
107 SET(PCRE_NEWLINE "LF" CACHE STRING
108 "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
109
110 SET(PCRE_NO_RECURSE OFF CACHE BOOL
111 "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 SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
117 "Enable support for Just-in-time compiling.")
118
119 SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
120 "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")
121
122 SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL
123 "Enable support for the Unicode UTF-8 encoding.")
124
125 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 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
132 IF (PCRE_BUILD_TESTS)
133 IF (NOT PCRE_BUILD_PCREGREP)
134 MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")
135 SET(PCRE_BUILD_PCREGREP ON)
136 ENDIF(NOT PCRE_BUILD_PCREGREP)
137 ENDIF(PCRE_BUILD_TESTS)
138
139 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
144 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 # 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
157 # 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
165 # 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
173 # 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 SET(pcre_have_type_traits 1)
180 ENDIF(HAVE_TYPE_TRAITS_H)
181
182 IF(HAVE_BITS_TYPE_TRAITS_H)
183 SET(pcre_have_bits_type_traits 1)
184 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 SET(pcre_have_long_long 1)
191 ENDIF(HAVE_LONG_LONG)
192
193 IF(HAVE_UNSIGNED_LONG_LONG)
194 SET(pcre_have_ulong_long 1)
195 ENDIF(HAVE_UNSIGNED_LONG_LONG)
196
197 IF(NOT BUILD_SHARED_LIBS)
198 SET(PCRE_STATIC 1)
199 ENDIF(NOT BUILD_SHARED_LIBS)
200
201 IF(PCRE_SUPPORT_BSR_ANYCRLF)
202 SET(BSR_ANYCRLF 1)
203 ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
204
205 IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
206 SET(SUPPORT_UTF8 1)
207 ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)
208
209 IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
210 SET(SUPPORT_UCP 1)
211 ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
212
213 IF(PCRE_SUPPORT_JIT)
214 SET(SUPPORT_JIT 1)
215 ENDIF(PCRE_SUPPORT_JIT)
216
217 # 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 IF(PCRE_SUPPORT_LIBREADLINE)
224 SET(SUPPORT_LIBREADLINE 1)
225 SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
226 ENDIF(PCRE_SUPPORT_LIBREADLINE)
227
228 IF(PCRE_SUPPORT_LIBZ)
229 SET(SUPPORT_LIBZ 1)
230 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
231 ENDIF(PCRE_SUPPORT_LIBZ)
232
233 IF(PCRE_SUPPORT_LIBBZ2)
234 SET(SUPPORT_LIBBZ2 1)
235 SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES})
236 ENDIF(PCRE_SUPPORT_LIBBZ2)
237
238 SET(NEWLINE "")
239
240 IF(PCRE_NEWLINE STREQUAL "LF")
241 SET(NEWLINE "10")
242 ENDIF(PCRE_NEWLINE STREQUAL "LF")
243 IF(PCRE_NEWLINE STREQUAL "CR")
244 SET(NEWLINE "13")
245 ENDIF(PCRE_NEWLINE STREQUAL "CR")
246 IF(PCRE_NEWLINE STREQUAL "CRLF")
247 SET(NEWLINE "3338")
248 ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
249 IF(PCRE_NEWLINE STREQUAL "ANY")
250 SET(NEWLINE "-1")
251 ENDIF(PCRE_NEWLINE STREQUAL "ANY")
252 IF(PCRE_NEWLINE STREQUAL "ANYCRLF")
253 SET(NEWLINE "-2")
254 ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF")
255
256 IF(NEWLINE STREQUAL "")
257 MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
258 ENDIF(NEWLINE STREQUAL "")
259
260 IF(PCRE_EBCDIC)
261 SET(EBCDIC 1)
262 ENDIF(PCRE_EBCDIC)
263
264 IF(PCRE_NO_RECURSE)
265 SET(NO_RECURSE 1)
266 ENDIF(PCRE_NO_RECURSE)
267
268 # Output files
269 CONFIGURE_FILE(config-cmake.h.in
270 ${PROJECT_BINARY_DIR}/config.h
271 @ONLY)
272
273 CONFIGURE_FILE(pcre.h.generic
274 ${PROJECT_BINARY_DIR}/pcre.h
275 COPYONLY)
276
277 # What about pcre-config and libpcre.pc?
278
279 IF(PCRE_BUILD_PCRECPP)
280 CONFIGURE_FILE(pcre_stringpiece.h.in
281 ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
282 @ONLY)
283
284 CONFIGURE_FILE(pcrecpparg.h.in
285 ${PROJECT_BINARY_DIR}/pcrecpparg.h
286 @ONLY)
287 ENDIF(PCRE_BUILD_PCRECPP)
288
289 # Character table generation
290
291 OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF)
292 IF(PCRE_REBUILD_CHARTABLES)
293 ADD_EXECUTABLE(dftables dftables.c)
294
295 GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION)
296
297 ADD_CUSTOM_COMMAND(
298 COMMENT "Generating character tables (pcre_chartables.c) for current locale"
299 DEPENDS dftables
300 COMMAND ${DFTABLES_EXE}
301 ARGS ${PROJECT_BINARY_DIR}/pcre_chartables.c
302 OUTPUT ${PROJECT_BINARY_DIR}/pcre_chartables.c
303 )
304 ELSE(PCRE_REBUILD_CHARTABLES)
305 CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist
306 ${PROJECT_BINARY_DIR}/pcre_chartables.c
307 COPYONLY)
308 ENDIF(PCRE_REBUILD_CHARTABLES)
309
310 # Source code
311
312 SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
313
314 SET(PCRE_SOURCES
315 ${PROJECT_BINARY_DIR}/pcre_chartables.c
316 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 pcre_jit_compile.c
325 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 pcre_ucd.c
333 pcre_valid_utf8.c
334 pcre_version.c
335 pcre_xclass.c
336 )
337
338 SET(PCREPOSIX_HEADERS pcreposix.h)
339
340 SET(PCREPOSIX_SOURCES pcreposix.c)
341
342 SET(PCRECPP_HEADERS
343 pcrecpp.h
344 pcre_scanner.h
345 ${PROJECT_BINARY_DIR}/pcrecpparg.h
346 ${PROJECT_BINARY_DIR}/pcre_stringpiece.h
347 )
348
349 SET(PCRECPP_SOURCES
350 pcrecpp.cc
351 pcre_scanner.cc
352 pcre_stringpiece.cc
353 )
354
355 # Build setup
356
357 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
358
359 IF(MSVC)
360 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
361 ENDIF(MSVC)
362
363 SET(CMAKE_INCLUDE_CURRENT_DIR 1)
364 # 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
370 SET(targets)
371
372 # Libraries
373 # pcre
374 ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
375 SET(targets ${targets} pcre)
376 ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
377 SET(targets ${targets} pcreposix)
378 TARGET_LINK_LIBRARIES(pcreposix pcre)
379 IF(MINGW AND NOT PCRE_STATIC)
380 IF(NON_STANDARD_LIB_PREFIX)
381 SET_TARGET_PROPERTIES(pcre pcreposix
382 PROPERTIES PREFIX ""
383 )
384 ENDIF(NON_STANDARD_LIB_PREFIX)
385
386 IF(NON_STANDARD_LIB_SUFFIX)
387 SET_TARGET_PROPERTIES(pcre pcreposix
388 PROPERTIES SUFFIX "-0.dll"
389 )
390 ENDIF(NON_STANDARD_LIB_SUFFIX)
391 ENDIF(MINGW AND NOT PCRE_STATIC)
392
393
394 # pcrecpp
395 IF(PCRE_BUILD_PCRECPP)
396 ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
397 SET(targets ${targets} pcrecpp)
398 TARGET_LINK_LIBRARIES(pcrecpp pcre)
399
400 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 ENDIF(PCRE_BUILD_PCRECPP)
414
415
416 # Executables
417
418 # 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 # SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
425 # ENDIF(NOT BUILD_SHARED_LIBS)
426
427 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
433
434 # Testing
435 IF(PCRE_BUILD_TESTS)
436 ENABLE_TESTING()
437
438 ADD_EXECUTABLE(pcretest pcretest.c)
439 SET(targets ${targets} pcretest)
440 TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})
441
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
448 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
458 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
462 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
467 GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
468 GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
469
470 # 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
480 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
488 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 GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE
495 pcrecpp_unittest
496 DEBUG_LOCATION)
497
498 GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE
499 pcre_scanner_unittest
500 DEBUG_LOCATION)
501
502 GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE
503 pcre_stringpiece_unittest
504 DEBUG_LOCATION)
505
506 IF(PCRE_SUPPORT_JIT)
507 ADD_TEST(pcre_jit_test ${PCRE_JIT_TEST_EXE})
508 ENDIF(PCRE_SUPPORT_JIT)
509 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 # Installation
515 SET(CMAKE_INSTALL_ALWAYS 1)
516
517 INSTALL(TARGETS ${targets}
518 RUNTIME DESTINATION bin
519 LIBRARY DESTINATION lib
520 ARCHIVE DESTINATION lib)
521
522 INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)
523
524 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
528 IF(PCRE_BUILD_PCRECPP)
529 INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
530 ELSE(PCRE_BUILD_PCRECPP)
531 # 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 ENDIF(PCRE_BUILD_PCRECPP)
540
541
542 INSTALL(FILES ${man1} DESTINATION man/man1)
543 INSTALL(FILES ${man3} DESTINATION man/man3)
544 INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
545
546 # 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 IF(PCRE_SHOW_REPORT)
554 STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
555 IF (CMAKE_C_FLAGS)
556 SET(cfsp " ")
557 ENDIF(CMAKE_C_FLAGS)
558 IF (CMAKE_CXX_FLAGS)
559 SET(cxxfsp " ")
560 ENDIF(CMAKE_CXX_FLAGS)
561 MESSAGE(STATUS "")
562 MESSAGE(STATUS "")
563 MESSAGE(STATUS "PCRE configuration summary:")
564 MESSAGE(STATUS "")
565 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 MESSAGE(STATUS "")
571 MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
572 MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
573 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 MESSAGE(STATUS " Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
588 MESSAGE(STATUS " Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}")
589 IF(ZLIB_FOUND)
590 MESSAGE(STATUS " Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
591 ELSE(ZLIB_FOUND)
592 MESSAGE(STATUS " Link pcregrep with libz ......... : None" )
593 ENDIF(ZLIB_FOUND)
594 IF(BZIP2_FOUND)
595 MESSAGE(STATUS " Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
596 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 MESSAGE(STATUS " Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
603 ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
604 IF(MINGW AND NOT PCRE_STATIC)
605 MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
606 MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
607 ENDIF(MINGW AND NOT PCRE_STATIC)
608 MESSAGE(STATUS "")
609 ENDIF(PCRE_SHOW_REPORT)
610
611 # end CMakeLists.txt

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12