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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 684 - (hide annotations) (download)
Tue Sep 6 10:44:57 2011 UTC (3 years ago) by ph10
File MIME type: text/plain
File size: 20913 byte(s)
Fix Win32 problem with user's patch.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12