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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 416 - (hide annotations) (download)
Sat Apr 11 14:34:02 2009 UTC (5 years, 8 months ago) by ph10
File MIME type: text/plain
File size: 19564 byte(s)
File tidies for 7.9 release.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12