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

Diff of /code/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 475 by ph10, Sat Jan 2 18:21:30 2010 UTC revision 1053 by zherczeg, Tue Oct 9 15:43:08 2012 UTC
# Line 36  Line 36 
36  # 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that  # 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
37  #            are set by specifying a release type.  #            are set by specifying a release type.
38  # 2010-01-02 PH added test for stdint.h  # 2010-01-02 PH added test for stdint.h
39    # 2010-03-02 PH added test for inttypes.h
40    # 2011-08-01 PH added PCREGREP_BUFSIZE
41    # 2011-08-22 PH added PCRE_SUPPORT_JIT
42    # 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov
43    # 2011-09-06 PH added PCRE_SUPPORT_PCREGREP_JIT
44    # 2011-10-04 Sheri added support for including coff data in windows shared libraries
45    #            compiled with MINGW if pcre.rc and/or pcreposix.rc are placed in
46    #            the source dir by the user prior to building
47    # 2011-10-04 Sheri changed various add_test's to use exes' location built instead
48    #            of DEBUG location only (likely only matters in MSVC)
49    # 2011-10-04 Sheri added scripts to provide needed variables to RunTest and
50    #            RunGrepTest (used for UNIX and Msys)
51    # 2011-10-04 Sheri added scripts to provide needed variables and to execute
52    #            RunTest.bat in Win32 (for effortless testing with "make test")
53    # 2011-10-04 Sheri Increased minimum required cmake version
54    # 2012-01-06 PH removed pcre_info.c and added pcre_string_utils.c
55    # 2012-01-10 Zoltan Herczeg added libpcre16 support
56    # 2012-01-13 Stephen Kelly added out of source build support
57    # 2012-01-17 PH applied Stephen Kelly's patch to parse the version data out
58    #            of the configure.ac file
59    # 2012-02-26 PH added support for libedit
60    # 2012-09-06 PH added support for PCRE_EBCDIC_NL25
61    
62  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
63    
64  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)  # Increased minimum to 2.8.0 to support newer add_test features
65    
66    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
67    
68  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
69    
# Line 47  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_D Line 71  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_D
71  FIND_PACKAGE( BZip2 )  FIND_PACKAGE( BZip2 )
72  FIND_PACKAGE( ZLIB )  FIND_PACKAGE( ZLIB )
73  FIND_PACKAGE( Readline )  FIND_PACKAGE( Readline )
74    FIND_PACKAGE( Editline )
75    
76  # Configuration checks  # Configuration checks
77    
# Line 57  INCLUDE(CheckTypeSize) Line 82  INCLUDE(CheckTypeSize)
82    
83  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)
84  CHECK_INCLUDE_FILE(stdint.h     HAVE_STDINT_H)  CHECK_INCLUDE_FILE(stdint.h     HAVE_STDINT_H)
85    CHECK_INCLUDE_FILE(inttypes.h   HAVE_INTTYPES_H)
86  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
87  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
88  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)
# Line 83  CHECK_TYPE_SIZE("unsigned long long" Line 109  CHECK_TYPE_SIZE("unsigned long long"
109  SET(BUILD_SHARED_LIBS OFF CACHE BOOL  SET(BUILD_SHARED_LIBS OFF CACHE BOOL
110      "Build shared libraries instead of static ones.")      "Build shared libraries instead of static ones.")
111    
112    OPTION(PCRE_BUILD_PCRE8 "Build 8 bit PCRE library" ON)
113    
114    OPTION(PCRE_BUILD_PCRE16 "Build 16 bit PCRE library" OFF)
115    
116  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
117    
118  SET(PCRE_EBCDIC OFF CACHE BOOL  SET(PCRE_EBCDIC OFF CACHE BOOL
119      "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)")      "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)")
120    
121    SET(PCRE_EBCDIC_NL25 OFF CACHE BOOL
122        "Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC.")
123    
124  SET(PCRE_LINK_SIZE "2" CACHE STRING  SET(PCRE_LINK_SIZE "2" CACHE STRING
125      "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")      "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
# Line 97  SET(PCRE_MATCH_LIMIT "10000000" CACHE ST Line 130  SET(PCRE_MATCH_LIMIT "10000000" CACHE ST
130  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
131      "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")      "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.")
132    
133    SET(PCREGREP_BUFSIZE "20480" CACHE STRING
134        "Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
135    
136  SET(PCRE_NEWLINE "LF" CACHE STRING  SET(PCRE_NEWLINE "LF" CACHE STRING
137      "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")      "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).")
138    
# Line 106  SET(PCRE_NO_RECURSE OFF CACHE BOOL Line 142  SET(PCRE_NO_RECURSE OFF CACHE BOOL
142  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
143      "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")      "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.")
144    
145  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL  SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
146      "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")      "Enable support for Just-in-time compiling.")
147    
148    SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
149        "Enable use of Just-in-time compiling in pcregrep.")
150    
151  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL  SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
152      "Enable support for the Unicode UTF-8 encoding.")      "Enable support for Unicode Transformation Format (UTF-8 and/or UTF-16) encoding.")
153    
154    SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
155        "Enable support for Unicode properties (if set, UTF support will be enabled as well).")
156    
157  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
158      "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")      "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
# Line 119  OPTION(PCRE_SHOW_REPORT    "Show the fin Line 161  OPTION(PCRE_SHOW_REPORT    "Show the fin
161  OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)  OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
162  OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)  OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
163    
 IF (PCRE_BUILD_TESTS)  
   IF (NOT PCRE_BUILD_PCREGREP)  
     MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON")  
     SET(PCRE_BUILD_PCREGREP ON)  
   ENDIF(NOT PCRE_BUILD_PCREGREP)  
 ENDIF(PCRE_BUILD_TESTS)  
   
164  IF (MINGW)  IF (MINGW)
165    OPTION(NON_STANDARD_LIB_PREFIX    OPTION(NON_STANDARD_LIB_PREFIX
166           "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."           "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
# Line 152  IF(PCRE_SUPPORT_LIBZ) Line 187  IF(PCRE_SUPPORT_LIBZ)
187    INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})    INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
188  ENDIF(PCRE_SUPPORT_LIBZ)  ENDIF(PCRE_SUPPORT_LIBZ)
189    
190    # editline lib
191    IF(EDITLINE_FOUND)
192      OPTION (PCRE_SUPPORT_LIBEDIT  "Enable support for linking pcretest with libedit." OFF)
193    ENDIF(EDITLINE_FOUND)
194    IF(PCRE_SUPPORT_LIBEDIT)
195      INCLUDE_DIRECTORIES(${EDITLINE_INCLUDE_DIR})
196    ENDIF(PCRE_SUPPORT_LIBEDIT)
197    
198  # readline lib  # readline lib
199  IF(READLINE_FOUND)  IF(READLINE_FOUND)
200    OPTION (PCRE_SUPPORT_LIBREADLINE  "Enable support for linking pcretest with libreadline." ON)    OPTION (PCRE_SUPPORT_LIBREADLINE  "Enable support for linking pcretest with libreadline." ON)
# Line 188  IF(NOT BUILD_SHARED_LIBS) Line 231  IF(NOT BUILD_SHARED_LIBS)
231          SET(PCRE_STATIC 1)          SET(PCRE_STATIC 1)
232  ENDIF(NOT BUILD_SHARED_LIBS)  ENDIF(NOT BUILD_SHARED_LIBS)
233    
234    IF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
235            MESSAGE(FATAL_ERROR "Either PCRE_BUILD_PCRE8 or PCRE_BUILD_PCRE16 must be enabled")
236    ENDIF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
237    
238    IF(PCRE_BUILD_PCRE8)
239            SET(SUPPORT_PCRE8 1)
240    ENDIF(PCRE_BUILD_PCRE8)
241    
242    IF(PCRE_BUILD_PCRE16)
243            SET(SUPPORT_PCRE16 1)
244    ENDIF(PCRE_BUILD_PCRE16)
245    
246    IF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
247            MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the C++ library support")
248            SET(PCRE_BUILD_PCRECPP OFF)
249    ENDIF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
250    
251    IF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
252            MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the pcregrep program")
253            SET(PCRE_BUILD_PCREGREP OFF)
254    ENDIF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
255    
256    IF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
257            MESSAGE(FATAL_ERROR "Only one of libreadline or libeditline can be specified")
258    ENDIF(PCRE_SUPPORT_LIBREADLINE AND PCRE_SUPPORT_LIBEDIT)
259    
260  IF(PCRE_SUPPORT_BSR_ANYCRLF)  IF(PCRE_SUPPORT_BSR_ANYCRLF)
261          SET(BSR_ANYCRLF 1)          SET(BSR_ANYCRLF 1)
262  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
263    
264  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
265          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF 1)
266  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)          SET(PCRE_SUPPORT_UTF ON)
267    ENDIF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
268    
269  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
270          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
271  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
272    
273    IF(PCRE_SUPPORT_JIT)
274            SET(SUPPORT_JIT 1)
275    ENDIF(PCRE_SUPPORT_JIT)
276    
277    IF(PCRE_SUPPORT_PCREGREP_JIT)
278            SET(SUPPORT_PCREGREP_JIT 1)
279    ENDIF(PCRE_SUPPORT_PCREGREP_JIT)
280    
281  # This next one used to contain  # This next one used to contain
282  #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})  #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})
283  # but I was advised to add the NCURSES test as well, along with  # but I was advised to add the NCURSES test as well, along with
# Line 211  IF(PCRE_SUPPORT_LIBREADLINE) Line 289  IF(PCRE_SUPPORT_LIBREADLINE)
289          SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})          SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
290  ENDIF(PCRE_SUPPORT_LIBREADLINE)  ENDIF(PCRE_SUPPORT_LIBREADLINE)
291    
292    # libedit is a plug-compatible alternative to libreadline
293    
294    IF(PCRE_SUPPORT_LIBEDIT)
295            SET(SUPPORT_LIBEDIT 1)
296            SET(PCRETEST_LIBS ${EDITLINE_LIBRARY} ${NCURSES_LIBRARY})
297    ENDIF(PCRE_SUPPORT_LIBEDIT)
298    
299  IF(PCRE_SUPPORT_LIBZ)  IF(PCRE_SUPPORT_LIBZ)
300          SET(SUPPORT_LIBZ 1)          SET(SUPPORT_LIBZ 1)
301          SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})          SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES})
# Line 245  ENDIF(NEWLINE STREQUAL "") Line 330  ENDIF(NEWLINE STREQUAL "")
330    
331  IF(PCRE_EBCDIC)  IF(PCRE_EBCDIC)
332          SET(EBCDIC 1)          SET(EBCDIC 1)
333    IF(PCRE_NEWLINE STREQUAL "LF")
334            SET(NEWLINE "21")
335    ENDIF(PCRE_NEWLINE STREQUAL "LF")
336    IF(PCRE_NEWLINE STREQUAL "CRLF")
337            SET(NEWLINE "3349")
338    ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
339  ENDIF(PCRE_EBCDIC)  ENDIF(PCRE_EBCDIC)
340    
341    IF(PCRE_EBCDIC_NL25)
342            SET(EBCDIC 1)
343            SET(EBCDIC_NL25 1)
344    IF(PCRE_NEWLINE STREQUAL "LF")
345            SET(NEWLINE "37")
346    ENDIF(PCRE_NEWLINE STREQUAL "LF")
347    IF(PCRE_NEWLINE STREQUAL "CRLF")
348            SET(NEWLINE "3365")
349    ENDIF(PCRE_NEWLINE STREQUAL "CRLF")
350    ENDIF(PCRE_EBCDIC_NL25)
351    
352  IF(PCRE_NO_RECURSE)  IF(PCRE_NO_RECURSE)
353          SET(NO_RECURSE 1)          SET(NO_RECURSE 1)
354  ENDIF(PCRE_NO_RECURSE)  ENDIF(PCRE_NO_RECURSE)
# Line 256  CONFIGURE_FILE(config-cmake.h.in Line 358  CONFIGURE_FILE(config-cmake.h.in
358                 ${PROJECT_BINARY_DIR}/config.h                 ${PROJECT_BINARY_DIR}/config.h
359                 @ONLY)                 @ONLY)
360    
361  CONFIGURE_FILE(pcre.h.generic  # Parse version numbers and date out of configure.ac
362    
363    file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
364      configure_lines
365      LIMIT_COUNT 50 # Read only the first 50 lines of the file
366    )
367    
368    set(SEARCHED_VARIABLES "pcre_major" "pcre_minor" "pcre_prerelease" "pcre_date")
369    foreach(configure_line ${configure_lines})
370        foreach(_substitution_variable ${SEARCHED_VARIABLES})
371            string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
372            if (NOT ${_substitution_variable_upper})
373                string(REGEX MATCH "m4_define\\(${_substitution_variable}, \\[(.*)\\]" MACTHED_STRING ${configure_line})
374                if (CMAKE_MATCH_1)
375                    set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
376                endif()
377            endif()
378        endforeach()
379    endforeach()
380    
381    CONFIGURE_FILE(pcre.h.in
382                 ${PROJECT_BINARY_DIR}/pcre.h                 ${PROJECT_BINARY_DIR}/pcre.h
383                 COPYONLY)                 @ONLY)
384    
385  # What about pcre-config and libpcre.pc?  # What about pcre-config and libpcre.pc?
386    
# Line 297  ENDIF(PCRE_REBUILD_CHARTABLES) Line 419  ENDIF(PCRE_REBUILD_CHARTABLES)
419    
420  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
421    
422    IF(PCRE_BUILD_PCRE8)
423  SET(PCRE_SOURCES  SET(PCRE_SOURCES
424    ${PROJECT_BINARY_DIR}/pcre_chartables.c    pcre_byte_order.c
425      pcre_chartables.c
426    pcre_compile.c    pcre_compile.c
427    pcre_config.c    pcre_config.c
428    pcre_dfa_exec.c    pcre_dfa_exec.c
# Line 306  SET(PCRE_SOURCES Line 430  SET(PCRE_SOURCES
430    pcre_fullinfo.c    pcre_fullinfo.c
431    pcre_get.c    pcre_get.c
432    pcre_globals.c    pcre_globals.c
433    pcre_info.c    pcre_jit_compile.c
   pcre_newline.c  
434    pcre_maketables.c    pcre_maketables.c
435      pcre_newline.c
436    pcre_ord2utf8.c    pcre_ord2utf8.c
437    pcre_refcount.c    pcre_refcount.c
438      pcre_string_utils.c
439    pcre_study.c    pcre_study.c
440    pcre_tables.c    pcre_tables.c
   pcre_try_flipped.c  
441    pcre_ucd.c    pcre_ucd.c
442    pcre_valid_utf8.c    pcre_valid_utf8.c
443    pcre_version.c    pcre_version.c
# Line 324  SET(PCREPOSIX_HEADERS pcreposix.h) Line 448  SET(PCREPOSIX_HEADERS pcreposix.h)
448    
449  SET(PCREPOSIX_SOURCES pcreposix.c)  SET(PCREPOSIX_SOURCES pcreposix.c)
450    
451    ENDIF(PCRE_BUILD_PCRE8)
452    
453    IF(PCRE_BUILD_PCRE16)
454    SET(PCRE16_SOURCES
455      pcre16_byte_order.c
456      pcre16_chartables.c
457      pcre16_compile.c
458      pcre16_config.c
459      pcre16_dfa_exec.c
460      pcre16_exec.c
461      pcre16_fullinfo.c
462      pcre16_get.c
463      pcre16_globals.c
464      pcre16_jit_compile.c
465      pcre16_maketables.c
466      pcre16_newline.c
467      pcre16_ord2utf16.c
468      pcre16_refcount.c
469      pcre16_string_utils.c
470      pcre16_study.c
471      pcre16_tables.c
472      pcre16_ucd.c
473      pcre16_utf16_utils.c
474      pcre16_valid_utf16.c
475      pcre16_version.c
476      pcre16_xclass.c
477    )
478    ENDIF(PCRE_BUILD_PCRE16)
479    
480    IF(MINGW AND NOT PCRE_STATIC)
481    IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
482    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre.o
483    PRE-LINK
484    COMMAND windres ARGS pcre.rc pcre.o
485    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
486    COMMENT Using pcre coff info in mingw build)
487    SET(PCRE_SOURCES
488      ${PCRE_SOURCES} ${PROJECT_SOURCE_DIR}/pcre.o
489    )
490    ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
491    IF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
492    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcreposix.o
493    PRE-LINK
494    COMMAND windres ARGS pcreposix.rc pcreposix.o
495    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
496    COMMENT Using pcreposix coff info in mingw build)
497    SET(PCREPOSIX_SOURCES
498      ${PCREPOSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcreposix.o
499    )
500    ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
501    ENDIF(MINGW AND NOT PCRE_STATIC)
502    
503  SET(PCRECPP_HEADERS  SET(PCRECPP_HEADERS
504    pcrecpp.h    pcrecpp.h
505    pcre_scanner.h    pcre_scanner.h
# Line 356  SET(targets) Line 532  SET(targets)
532    
533  # Libraries  # Libraries
534  # pcre  # pcre
535    IF(PCRE_BUILD_PCRE8)
536  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
537  SET(targets ${targets} pcre)  SET(targets ${targets} pcre)
538  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
539  SET(targets ${targets} pcreposix)  SET(targets ${targets} pcreposix)
540  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
541    
542  IF(MINGW AND NOT PCRE_STATIC)  IF(MINGW AND NOT PCRE_STATIC)
543    IF(NON_STANDARD_LIB_PREFIX)    IF(NON_STANDARD_LIB_PREFIX)
544      SET_TARGET_PROPERTIES(pcre pcreposix      SET_TARGET_PROPERTIES(pcre pcreposix
# Line 375  IF(MINGW AND NOT PCRE_STATIC) Line 553  IF(MINGW AND NOT PCRE_STATIC)
553    ENDIF(NON_STANDARD_LIB_SUFFIX)    ENDIF(NON_STANDARD_LIB_SUFFIX)
554  ENDIF(MINGW AND NOT PCRE_STATIC)  ENDIF(MINGW AND NOT PCRE_STATIC)
555    
556    ENDIF(PCRE_BUILD_PCRE8)
557    
558    IF(PCRE_BUILD_PCRE16)
559    ADD_LIBRARY(pcre16 ${PCRE_HEADERS} ${PCRE16_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
560    SET(targets ${targets} pcre16)
561    
562    IF(MINGW AND NOT PCRE_STATIC)
563      IF(NON_STANDARD_LIB_PREFIX)
564        SET_TARGET_PROPERTIES(pcre16
565                            PROPERTIES PREFIX ""
566        )
567      ENDIF(NON_STANDARD_LIB_PREFIX)
568    
569      IF(NON_STANDARD_LIB_SUFFIX)
570        SET_TARGET_PROPERTIES(pcre16
571                            PROPERTIES SUFFIX "-0.dll"
572        )
573      ENDIF(NON_STANDARD_LIB_SUFFIX)
574    ENDIF(MINGW AND NOT PCRE_STATIC)
575    
576    ENDIF(PCRE_BUILD_PCRE16)
577    
578  # pcrecpp  # pcrecpp
579  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
580    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})  ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
581  SET(targets ${targets} pcrecpp)  SET(targets ${targets} pcrecpp)
582    TARGET_LINK_LIBRARIES(pcrecpp pcre)  TARGET_LINK_LIBRARIES(pcrecpp pcre)
583    
584    IF(MINGW AND NOT PCRE_STATIC)    IF(MINGW AND NOT PCRE_STATIC)
585      IF(NON_STANDARD_LIB_PREFIX)      IF(NON_STANDARD_LIB_PREFIX)
# Line 415  IF(PCRE_BUILD_PCREGREP) Line 614  IF(PCRE_BUILD_PCREGREP)
614    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
615  ENDIF(PCRE_BUILD_PCREGREP)  ENDIF(PCRE_BUILD_PCREGREP)
616    
   
617  # Testing  # Testing
618  IF(PCRE_BUILD_TESTS)  IF(PCRE_BUILD_TESTS)
619    ENABLE_TESTING()    ENABLE_TESTING()
620    
621    ADD_EXECUTABLE(pcretest pcretest.c)    SET(PCRETEST_SOURCES pcretest.c)
622      IF(PCRE_BUILD_PCRE8)
623        LIST(APPEND PCRETEST_SOURCES pcre_printint.c)
624      ENDIF(PCRE_BUILD_PCRE8)
625      IF(PCRE_BUILD_PCRE16)
626        LIST(APPEND PCRETEST_SOURCES pcre16_printint.c)
627      ENDIF(PCRE_BUILD_PCRE16)
628    
629      ADD_EXECUTABLE(pcretest ${PCRETEST_SOURCES})
630    SET(targets ${targets} pcretest)    SET(targets ${targets} pcretest)
631    TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})    IF(PCRE_BUILD_PCRE8)
632        LIST(APPEND PCRETEST_LIBS pcreposix pcre)
633      ENDIF(PCRE_BUILD_PCRE8)
634      IF(PCRE_BUILD_PCRE16)
635        LIST(APPEND PCRETEST_LIBS pcre16)
636      ENDIF(PCRE_BUILD_PCRE16)
637      TARGET_LINK_LIBRARIES(pcretest ${PCRETEST_LIBS})
638    
639      IF(PCRE_SUPPORT_JIT)
640        ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
641        SET(targets ${targets} pcre_jit_test)
642        SET(PCRE_JIT_TEST_LIBS )
643        IF(PCRE_BUILD_PCRE8)
644          LIST(APPEND PCRE_JIT_TEST_LIBS pcre)
645        ENDIF(PCRE_BUILD_PCRE8)
646        IF(PCRE_BUILD_PCRE16)
647          LIST(APPEND PCRE_JIT_TEST_LIBS pcre16)
648        ENDIF(PCRE_BUILD_PCRE16)
649        TARGET_LINK_LIBRARIES(pcre_jit_test ${PCRE_JIT_TEST_LIBS})
650      ENDIF(PCRE_SUPPORT_JIT)
651    
652    IF(PCRE_BUILD_PCRECPP)    IF(PCRE_BUILD_PCRECPP)
653      ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)      ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
# Line 434  IF(PCRE_BUILD_TESTS) Line 659  IF(PCRE_BUILD_TESTS)
659        )        )
660      ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)      ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
661    
   
662      ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)      ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
663      SET(targets ${targets} pcre_scanner_unittest)      SET(targets ${targets} pcre_scanner_unittest)
664      TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)      TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
# Line 444  IF(PCRE_BUILD_TESTS) Line 668  IF(PCRE_BUILD_TESTS)
668      TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)      TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
669    ENDIF(PCRE_BUILD_PCRECPP)    ENDIF(PCRE_BUILD_PCRECPP)
670    
671    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)    # exes in Debug location tested by the RunTest shell script
672      # via "make test"
673      IF(PCRE_BUILD_PCREGREP)
674        GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
675      ENDIF(PCRE_BUILD_PCREGREP)
676    
677    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
678    
679    # Write out a CTest configuration file that sets some needed environment  # =================================================
680    # variables for the test scripts.    # Write out a CTest configuration file
681    #    #
682    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
683    "# This is a generated file.    "# This is a generated file.
684    SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})  MESSAGE(\"When testing is complete, review test output in the
685    SET(ENV{pcregrep} ${PCREGREP_EXE})  \\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
686    SET(ENV{pcretest} ${PCRETEST_EXE})  MESSAGE(\" \")
687    ")  ")
688    
689      FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
690      "#! /bin/sh
691    # This is a generated file.
692    srcdir=${PROJECT_SOURCE_DIR}
693    pcretest=${PCRETEST_EXE}
694    source ${PROJECT_SOURCE_DIR}/RunTest
695    if test \"$?\" != \"0\"; then exit 1; fi
696    # End
697    ")
698    
699    IF(UNIX)    IF(UNIX)
700            ADD_TEST(pcre_test      ${PROJECT_SOURCE_DIR}/RunTest)      ADD_TEST(pcre_test      sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
           ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)  
701    ENDIF(UNIX)    ENDIF(UNIX)
702    
703      IF(PCRE_BUILD_PCREGREP)
704        FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
705        "#! /bin/sh
706    # This is a generated file.
707    srcdir=${PROJECT_SOURCE_DIR}
708    pcregrep=${PCREGREP_EXE}
709    pcretest=${PCRETEST_EXE}
710    source ${PROJECT_SOURCE_DIR}/RunGrepTest
711    if test \"$?\" != \"0\"; then exit 1; fi
712    # End
713    ")
714    
715        IF(UNIX)
716          ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
717        ENDIF(UNIX)
718      ENDIF(PCRE_BUILD_PCREGREP)
719    
720    IF(WIN32)    IF(WIN32)
721            ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)      # Provide environment for executing the bat file version of RunTest
722        FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
723        FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)
724        FILE(TO_NATIVE_PATH ${PCRETEST_EXE} winexe)
725    
726        FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.bat
727        "\@REM This is a generated file.
728    \@echo off
729    setlocal
730    SET srcdir=\"${winsrc}\"
731    SET pcretest=\"${winexe}\"
732    if not [%CMAKE_CONFIG_TYPE%]==[] SET pcretest=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcretest.exe\"
733    call %srcdir%\\RunTest.Bat
734    if errorlevel 1 exit /b 1
735    echo RunTest.bat tests successfully completed
736    ")
737    
738      ADD_TEST(NAME pcre_test_bat
739      COMMAND pcre_test.bat)
740      SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
741      PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
742    
743        IF("$ENV{OSTYPE}" STREQUAL "msys")
744          # Both the sh and bat file versions of RunTest are run if make test is used
745          # in msys
746          ADD_TEST(pcre_test_sh    sh.exe ${PROJECT_BINARY_DIR}/pcre_test.sh)
747          IF(PCRE_BUILD_PCREGREP)
748            ADD_TEST(pcre_grep_test  sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
749          ENDIF(PCRE_BUILD_PCREGREP)
750        ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
751    
752    ENDIF(WIN32)    ENDIF(WIN32)
753    
754    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE    # Changed to accommodate testing whichever location was just built
755                        pcrecpp_unittest  
756                        DEBUG_LOCATION)    IF(PCRE_SUPPORT_JIT)
757        ADD_TEST(pcre_jit_test         pcre_jit_test)
758    GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE    ENDIF(PCRE_SUPPORT_JIT)
759                        pcre_scanner_unittest  
760                        DEBUG_LOCATION)    IF(PCRE_BUILD_PCRECPP)
761        ADD_TEST(pcrecpp_test          pcrecpp_unittest)
762    GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE      ADD_TEST(pcre_scanner_test     pcre_scanner_unittest)
763                        pcre_stringpiece_unittest      ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
764                        DEBUG_LOCATION)    ENDIF(PCRE_BUILD_PCRECPP)
765    
   ADD_TEST(pcrecpp_test          ${PCRECPP_UNITTEST_EXE})  
   ADD_TEST(pcre_scanner_test     ${PCRE_SCANNER_UNITTEST_EXE})  
   ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE})  
766  ENDIF(PCRE_BUILD_TESTS)  ENDIF(PCRE_BUILD_TESTS)
767    
768  # Installation  # Installation
# Line 509  ELSE(PCRE_BUILD_PCRECPP) Line 792  ELSE(PCRE_BUILD_PCRECPP)
792          SET(man3 ${man3_new})          SET(man3 ${man3_new})
793  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
794    
   
795  INSTALL(FILES ${man1} DESTINATION man/man1)  INSTALL(FILES ${man1} DESTINATION man/man1)
796  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
797  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
# Line 539  IF(PCRE_SHOW_REPORT) Line 821  IF(PCRE_SHOW_REPORT)
821    MESSAGE(STATUS "  C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")    MESSAGE(STATUS "  C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
822    MESSAGE(STATUS "  C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")    MESSAGE(STATUS "  C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
823    MESSAGE(STATUS "")    MESSAGE(STATUS "")
824      MESSAGE(STATUS "  Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
825      MESSAGE(STATUS "  Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
826    MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")    MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
827    MESSAGE(STATUS "  Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")    MESSAGE(STATUS "  Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
828      MESSAGE(STATUS "  Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
829    MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")    MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
830    MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")    MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")
831    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
832    MESSAGE(STATUS "  EBCDIC coding ................... : ${PCRE_EBCDIC}")    MESSAGE(STATUS "  EBCDIC coding ................... : ${PCRE_EBCDIC}")
833      MESSAGE(STATUS "  EBCDIC coding with NL=0x25 ...... : ${PCRE_EBCDIC_NL25}")
834    MESSAGE(STATUS "  Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")    MESSAGE(STATUS "  Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
835    MESSAGE(STATUS "  No stack recursion .............. : ${PCRE_NO_RECURSE}")    MESSAGE(STATUS "  No stack recursion .............. : ${PCRE_NO_RECURSE}")
836    MESSAGE(STATUS "  POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")    MESSAGE(STATUS "  POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
# Line 554  IF(PCRE_SHOW_REPORT) Line 840  IF(PCRE_SHOW_REPORT)
840    MESSAGE(STATUS "  Build shared libs ............... : ${BUILD_SHARED_LIBS}")    MESSAGE(STATUS "  Build shared libs ............... : ${BUILD_SHARED_LIBS}")
841    MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")    MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")
842    MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")    MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
843    MESSAGE(STATUS "  Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}")    MESSAGE(STATUS "  Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
844      MESSAGE(STATUS "  Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
845      MESSAGE(STATUS "  Build tests (implies pcretest  .. : ${PCRE_BUILD_TESTS}")
846      MESSAGE(STATUS "               and pcregrep)")
847    IF(ZLIB_FOUND)    IF(ZLIB_FOUND)
848      MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")      MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
849    ELSE(ZLIB_FOUND)    ELSE(ZLIB_FOUND)
850      MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )      MESSAGE(STATUS "  Link pcregrep with libz ......... : Library not found" )
851    ENDIF(ZLIB_FOUND)    ENDIF(ZLIB_FOUND)
852    IF(BZIP2_FOUND)    IF(BZIP2_FOUND)
853      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
854    ELSE(BZIP2_FOUND)    ELSE(BZIP2_FOUND)
855      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )      MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : Library not found" )
856    ENDIF(BZIP2_FOUND)    ENDIF(BZIP2_FOUND)
857    IF(NOT PCRE_SUPPORT_LIBREADLINE)    IF(EDITLINE_FOUND)
858      MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )      MESSAGE(STATUS "  Link pcretest with libeditline .. : ${PCRE_SUPPORT_LIBEDIT}")
859    ELSE(NOT PCRE_SUPPORT_LIBREADLINE)    ELSE(EDITLINE_FOUND)
860        MESSAGE(STATUS "  Link pcretest with libeditline .. : Library not found" )
861      ENDIF(EDITLINE_FOUND)
862      IF(READLINE_FOUND)
863      MESSAGE(STATUS "  Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")      MESSAGE(STATUS "  Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
864    ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)    ELSE(READLINE_FOUND)
865        MESSAGE(STATUS "  Link pcretest with libreadline .. : Library not found" )
866      ENDIF(READLINE_FOUND)
867    
868    IF(MINGW AND NOT PCRE_STATIC)    IF(MINGW AND NOT PCRE_STATIC)
869      MESSAGE(STATUS "  Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")      MESSAGE(STATUS "  Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
870      MESSAGE(STATUS "  Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")      MESSAGE(STATUS "  Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")

Legend:
Removed from v.475  
changed lines
  Added in v.1053

  ViewVC Help
Powered by ViewVC 1.1.5