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

Contents of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 411 - (hide annotations) (download)
Fri Apr 10 15:40:21 2009 UTC (5 years, 3 months ago) by ph10
File MIME type: text/plain
File size: 19219 byte(s)
Wrap fileno/isatty defs for Windows in #ifndefs

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12