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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 495 - (hide annotations) (download)
Tue Mar 2 11:56:59 2010 UTC (4 years, 5 months ago) by ph10
File MIME type: text/plain
File size: 19742 byte(s)
Ensure CMake checks for inttypes.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12