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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 685 - (hide annotations) (download)
Tue Sep 6 15:02:07 2011 UTC (3 years ago) by ph10
File MIME type: text/plain
File size: 21319 byte(s)
Update pcregrep to use JIT by default with options to disable.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12