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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 475 - (hide annotations) (download)
Sat Jan 2 18:21:30 2010 UTC (4 years, 8 months ago) by ph10
File MIME type: text/plain
File size: 19651 byte(s)
Tidies to allow easier embedded compilation; avoid (double) where possible.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12