/[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 405 by ph10, Mon Mar 23 12:05:20 2009 UTC revision 886 by ph10, Tue Jan 17 14:25:07 2012 UTC
# Line 27  Line 27 
27  # 2008-01-23 PH removed the automatic build of pcredemo.  # 2008-01-23 PH removed the automatic build of pcredemo.
28  # 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.  # 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
29  # 2008-07-03 PH updated for revised UCP property support (change of files)  # 2008-07-03 PH updated for revised UCP property support (change of files)
30  # 2009-03-23 PH applied  Steven Van Ingelgem's patch to change the name  # 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name
31  #            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE  #            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
32  #            is included within another project.  #            is included within another project.
33    # 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    # 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
37    #            are set by specifying a release type.
38    # 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    
60  PROJECT(PCRE C CXX)  PROJECT(PCRE C CXX)
61    
62  CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6)  # Increased minimum to 2.8.0 to support newer add_test features
63    
64    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
65    
66  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake  SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
67    
# Line 50  INCLUDE(CheckFunctionExists) Line 78  INCLUDE(CheckFunctionExists)
78  INCLUDE(CheckTypeSize)  INCLUDE(CheckTypeSize)
79    
80  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)  CHECK_INCLUDE_FILE(dirent.h     HAVE_DIRENT_H)
81    CHECK_INCLUDE_FILE(stdint.h     HAVE_STDINT_H)
82    CHECK_INCLUDE_FILE(inttypes.h   HAVE_INTTYPES_H)
83  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)  CHECK_INCLUDE_FILE(sys/stat.h   HAVE_SYS_STAT_H)
84  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)  CHECK_INCLUDE_FILE(sys/types.h  HAVE_SYS_TYPES_H)
85  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)  CHECK_INCLUDE_FILE(unistd.h     HAVE_UNISTD_H)
# Line 76  CHECK_TYPE_SIZE("unsigned long long" Line 106  CHECK_TYPE_SIZE("unsigned long long"
106  SET(BUILD_SHARED_LIBS OFF CACHE BOOL  SET(BUILD_SHARED_LIBS OFF CACHE BOOL
107      "Build shared libraries instead of static ones.")      "Build shared libraries instead of static ones.")
108    
109    OPTION(PCRE_BUILD_PCRE8 "Build 8 bit PCRE library" ON)
110    
111    OPTION(PCRE_BUILD_PCRE16 "Build 16 bit PCRE library" OFF)
112    
113  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)  OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON)
114    
115  SET(PCRE_EBCDIC OFF CACHE BOOL  SET(PCRE_EBCDIC OFF CACHE BOOL
# Line 90  SET(PCRE_MATCH_LIMIT "10000000" CACHE ST Line 124  SET(PCRE_MATCH_LIMIT "10000000" CACHE ST
124  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING  SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING
125      "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.")
126    
127    SET(PCREGREP_BUFSIZE "20480" CACHE STRING
128        "Buffer size parameter for pcregrep. See PCREGREP_BUFSIZE in config.h.in for details.")
129    
130  SET(PCRE_NEWLINE "LF" CACHE STRING  SET(PCRE_NEWLINE "LF" CACHE STRING
131      "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).")
132    
# Line 99  SET(PCRE_NO_RECURSE OFF CACHE BOOL Line 136  SET(PCRE_NO_RECURSE OFF CACHE BOOL
136  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING  SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING
137      "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.")
138    
139  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL  SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
140      "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")      "Enable support for Just-in-time compiling.")
141    
142  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL  SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
143      "Enable support for the Unicode UTF-8 encoding.")      "Enable use of Just-in-time compiling in pcregrep.")
144    
145    SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
146        "Enable support for Unicode Transformation Format (UTF-8 and/or UTF-16) encoding.")
147    
148    SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
149        "Enable support for Unicode properties (if set, UTF support will be enabled as well).")
150    
151  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL  SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
152      "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")
153    
154    OPTION(PCRE_SHOW_REPORT    "Show the final configuration report" ON)
155    OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
156    OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
157    
158  IF (MINGW)  IF (MINGW)
159    OPTION(NON_STANDARD_LIB_PREFIX    OPTION(NON_STANDARD_LIB_PREFIX
# Line 171  IF(NOT BUILD_SHARED_LIBS) Line 217  IF(NOT BUILD_SHARED_LIBS)
217          SET(PCRE_STATIC 1)          SET(PCRE_STATIC 1)
218  ENDIF(NOT BUILD_SHARED_LIBS)  ENDIF(NOT BUILD_SHARED_LIBS)
219    
220    IF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
221            MESSAGE(FATAL_ERROR "Either PCRE_BUILD_PCRE8 or PCRE_BUILD_PCRE16 must be enabled")
222    ENDIF(NOT PCRE_BUILD_PCRE8 AND NOT PCRE_BUILD_PCRE16)
223    
224    IF(PCRE_BUILD_PCRE8)
225            SET(SUPPORT_PCRE8 1)
226    ENDIF(PCRE_BUILD_PCRE8)
227    
228    IF(PCRE_BUILD_PCRE16)
229            SET(SUPPORT_PCRE16 1)
230    ENDIF(PCRE_BUILD_PCRE16)
231    
232    IF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
233            MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the C++ library support")
234            SET(PCRE_BUILD_PCRECPP OFF)
235    ENDIF(PCRE_BUILD_PCRECPP AND NOT PCRE_BUILD_PCRE8)
236    
237    IF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
238            MESSAGE(STATUS "** PCRE_BUILD_PCRE8 must be enabled for the pcregrep program")
239            SET(PCRE_BUILD_PCREGREP OFF)
240    ENDIF(PCRE_BUILD_PCREGREP AND NOT PCRE_BUILD_PCRE8)
241    
242  IF(PCRE_SUPPORT_BSR_ANYCRLF)  IF(PCRE_SUPPORT_BSR_ANYCRLF)
243          SET(BSR_ANYCRLF 1)          SET(BSR_ANYCRLF 1)
244  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)  ENDIF(PCRE_SUPPORT_BSR_ANYCRLF)
245    
246  IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
247          SET(SUPPORT_UTF8 1)          SET(SUPPORT_UTF 1)
248  ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES)          SET(PCRE_SUPPORT_UTF ON)
249    ENDIF(PCRE_SUPPORT_UTF OR PCRE_SUPPORT_UNICODE_PROPERTIES)
250    
251  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)  IF(PCRE_SUPPORT_UNICODE_PROPERTIES)
252          SET(SUPPORT_UCP 1)          SET(SUPPORT_UCP 1)
253  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)  ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES)
254    
255    IF(PCRE_SUPPORT_JIT)
256            SET(SUPPORT_JIT 1)
257    ENDIF(PCRE_SUPPORT_JIT)
258    
259    IF(PCRE_SUPPORT_PCREGREP_JIT)
260            SET(SUPPORT_PCREGREP_JIT 1)
261    ENDIF(PCRE_SUPPORT_PCREGREP_JIT)
262    
263  # This next one used to contain  # This next one used to contain
264  #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})  #       SET(PCRETEST_LIBS ${READLINE_LIBRARY})
265  # 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 239  CONFIGURE_FILE(config-cmake.h.in Line 316  CONFIGURE_FILE(config-cmake.h.in
316                 ${PROJECT_BINARY_DIR}/config.h                 ${PROJECT_BINARY_DIR}/config.h
317                 @ONLY)                 @ONLY)
318    
319  CONFIGURE_FILE(pcre.h.generic  # Parse version numbers and date out of configure.ac
320    
321    file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
322      configure_lines
323      LIMIT_COUNT 50 # Read only the first 50 lines of the file
324    )
325    
326    set(SEARCHED_VARIABLES "pcre_major" "pcre_minor" "pcre_prerelease" "pcre_date")
327    foreach(configure_line ${configure_lines})
328        foreach(_substitution_variable ${SEARCHED_VARIABLES})
329            string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
330            if (NOT ${_substitution_variable_upper})
331                string(REGEX MATCH "m4_define\\(${_substitution_variable}, \\[(.*)\\]" MACTHED_STRING ${configure_line})
332                if (CMAKE_MATCH_1)
333                    set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
334                endif()
335            endif()
336        endforeach()
337    endforeach()
338    
339    CONFIGURE_FILE(pcre.h.in
340                 ${PROJECT_BINARY_DIR}/pcre.h                 ${PROJECT_BINARY_DIR}/pcre.h
341                 COPYONLY)                 @ONLY)
342    
343  # What about pcre-config and libpcre.pc?  # What about pcre-config and libpcre.pc?
344    
# Line 280  ENDIF(PCRE_REBUILD_CHARTABLES) Line 377  ENDIF(PCRE_REBUILD_CHARTABLES)
377    
378  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)  SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h)
379    
380    IF(PCRE_BUILD_PCRE8)
381  SET(PCRE_SOURCES  SET(PCRE_SOURCES
382    ${PROJECT_BINARY_DIR}/pcre_chartables.c    pcre_byte_order.c
383      pcre_chartables.c
384    pcre_compile.c    pcre_compile.c
385    pcre_config.c    pcre_config.c
386    pcre_dfa_exec.c    pcre_dfa_exec.c
# Line 289  SET(PCRE_SOURCES Line 388  SET(PCRE_SOURCES
388    pcre_fullinfo.c    pcre_fullinfo.c
389    pcre_get.c    pcre_get.c
390    pcre_globals.c    pcre_globals.c
391    pcre_info.c    pcre_jit_compile.c
   pcre_newline.c  
392    pcre_maketables.c    pcre_maketables.c
393      pcre_newline.c
394    pcre_ord2utf8.c    pcre_ord2utf8.c
395    pcre_refcount.c    pcre_refcount.c
396      pcre_string_utils.c
397    pcre_study.c    pcre_study.c
398    pcre_tables.c    pcre_tables.c
   pcre_try_flipped.c  
399    pcre_ucd.c    pcre_ucd.c
400    pcre_valid_utf8.c    pcre_valid_utf8.c
401    pcre_version.c    pcre_version.c
# Line 307  SET(PCREPOSIX_HEADERS pcreposix.h) Line 406  SET(PCREPOSIX_HEADERS pcreposix.h)
406    
407  SET(PCREPOSIX_SOURCES pcreposix.c)  SET(PCREPOSIX_SOURCES pcreposix.c)
408    
409    ENDIF(PCRE_BUILD_PCRE8)
410    
411    IF(PCRE_BUILD_PCRE16)
412    SET(PCRE16_SOURCES
413      pcre16_byte_order.c
414      pcre16_chartables.c
415      pcre16_compile.c
416      pcre16_config.c
417      pcre16_dfa_exec.c
418      pcre16_exec.c
419      pcre16_fullinfo.c
420      pcre16_get.c
421      pcre16_globals.c
422      pcre16_jit_compile.c
423      pcre16_maketables.c
424      pcre16_newline.c
425      pcre16_ord2utf16.c
426      pcre16_refcount.c
427      pcre16_string_utils.c
428      pcre16_study.c
429      pcre16_tables.c
430      pcre16_ucd.c
431      pcre16_utf16_utils.c
432      pcre16_valid_utf16.c
433      pcre16_version.c
434      pcre16_xclass.c
435    )
436    ENDIF(PCRE_BUILD_PCRE16)
437    
438    IF(MINGW AND NOT PCRE_STATIC)
439    IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
440    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre.o
441    PRE-LINK
442    COMMAND windres ARGS pcre.rc pcre.o
443    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
444    COMMENT Using pcre coff info in mingw build)
445    SET(PCRE_SOURCES
446      ${PCRE_SOURCES} ${PROJECT_SOURCE_DIR}/pcre.o
447    )
448    ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre.rc)
449    IF (EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
450    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcreposix.o
451    PRE-LINK
452    COMMAND windres ARGS pcreposix.rc pcreposix.o
453    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
454    COMMENT Using pcreposix coff info in mingw build)
455    SET(PCREPOSIX_SOURCES
456      ${PCREPOSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcreposix.o
457    )
458    ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcreposix.rc)
459    ENDIF(MINGW AND NOT PCRE_STATIC)
460    
461  SET(PCRECPP_HEADERS  SET(PCRECPP_HEADERS
462    pcrecpp.h    pcrecpp.h
463    pcre_scanner.h    pcre_scanner.h
# Line 335  IF(WIN32) Line 486  IF(WIN32)
486    SET(CMAKE_DEBUG_POSTFIX "d")    SET(CMAKE_DEBUG_POSTFIX "d")
487  ENDIF(WIN32)  ENDIF(WIN32)
488    
489    SET(targets)
490    
491  # Libraries  # Libraries
492  # pcre  # pcre
493    IF(PCRE_BUILD_PCRE8)
494  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)  ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
495    SET(targets ${targets} pcre)
496  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
497    SET(targets ${targets} pcreposix)
498  TARGET_LINK_LIBRARIES(pcreposix pcre)  TARGET_LINK_LIBRARIES(pcreposix pcre)
499    
500  IF(MINGW AND NOT PCRE_STATIC)  IF(MINGW AND NOT PCRE_STATIC)
501    IF(NON_STANDARD_LIB_PREFIX)    IF(NON_STANDARD_LIB_PREFIX)
502      SET_TARGET_PROPERTIES(pcre pcreposix      SET_TARGET_PROPERTIES(pcre pcreposix
# Line 354  IF(MINGW AND NOT PCRE_STATIC) Line 511  IF(MINGW AND NOT PCRE_STATIC)
511    ENDIF(NON_STANDARD_LIB_SUFFIX)    ENDIF(NON_STANDARD_LIB_SUFFIX)
512  ENDIF(MINGW AND NOT PCRE_STATIC)  ENDIF(MINGW AND NOT PCRE_STATIC)
513    
514    ENDIF(PCRE_BUILD_PCRE8)
515    
516    IF(PCRE_BUILD_PCRE16)
517    ADD_LIBRARY(pcre16 ${PCRE_HEADERS} ${PCRE16_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
518    SET(targets ${targets} pcre16)
519    
520    IF(MINGW AND NOT PCRE_STATIC)
521      IF(NON_STANDARD_LIB_PREFIX)
522        SET_TARGET_PROPERTIES(pcre16
523                            PROPERTIES PREFIX ""
524        )
525      ENDIF(NON_STANDARD_LIB_PREFIX)
526    
527      IF(NON_STANDARD_LIB_SUFFIX)
528        SET_TARGET_PROPERTIES(pcre16
529                            PROPERTIES SUFFIX "-0.dll"
530        )
531      ENDIF(NON_STANDARD_LIB_SUFFIX)
532    ENDIF(MINGW AND NOT PCRE_STATIC)
533    
534    ENDIF(PCRE_BUILD_PCRE16)
535    
536  # pcrecpp  # pcrecpp
537  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
538    ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})  ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES})
539    TARGET_LINK_LIBRARIES(pcrecpp pcre)  SET(targets ${targets} pcrecpp)
540    TARGET_LINK_LIBRARIES(pcrecpp 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)
# Line 378  ENDIF(PCRE_BUILD_PCRECPP) Line 557  ENDIF(PCRE_BUILD_PCRECPP)
557    
558  # Executables  # Executables
559    
 ADD_EXECUTABLE(pcretest pcretest.c)  
 TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})  
   
 ADD_EXECUTABLE(pcregrep pcregrep.c)  
 TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})  
   
560  # Removed by PH (2008-01-23) because pcredemo shouldn't really be built  # Removed by PH (2008-01-23) because pcredemo shouldn't really be built
561  # automatically, and it gave trouble in some environments anyway.  # automatically, and it gave trouble in some environments anyway.
562  # ADD_EXECUTABLE(pcredemo pcredemo.c)  # ADD_EXECUTABLE(pcredemo pcredemo.c)
# Line 393  TARGET_LINK_LIBRARIES(pcregrep pcreposix Line 566  TARGET_LINK_LIBRARIES(pcregrep pcreposix
566  #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")  #         SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
567  # ENDIF(NOT BUILD_SHARED_LIBS)  # ENDIF(NOT BUILD_SHARED_LIBS)
568    
569  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCREGREP)
570          ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)    ADD_EXECUTABLE(pcregrep pcregrep.c)
571          TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)    SET(targets ${targets} pcregrep)
572  IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
573  SET_TARGET_PROPERTIES(pcrecpp  ENDIF(PCRE_BUILD_PCREGREP)
                         PROPERTIES PREFIX ""  
 )  
 ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)  
574    
575    # Testing
576    IF(PCRE_BUILD_TESTS)
577      ENABLE_TESTING()
578    
579          ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)    SET(PCRETEST_SOURCES pcretest.c)
580          TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)    IF(PCRE_BUILD_PCRE8)
581        LIST(APPEND PCRETEST_SOURCES pcre_printint.c)
582      ENDIF(PCRE_BUILD_PCRE8)
583      IF(PCRE_BUILD_PCRE16)
584        LIST(APPEND PCRETEST_SOURCES pcre16_printint.c)
585      ENDIF(PCRE_BUILD_PCRE16)
586    
587      ADD_EXECUTABLE(pcretest ${PCRETEST_SOURCES})
588      SET(targets ${targets} pcretest)
589      IF(PCRE_BUILD_PCRE8)
590        LIST(APPEND PCRETEST_LIBS pcreposix pcre)
591      ENDIF(PCRE_BUILD_PCRE8)
592      IF(PCRE_BUILD_PCRE16)
593        LIST(APPEND PCRETEST_LIBS pcre16)
594      ENDIF(PCRE_BUILD_PCRE16)
595      TARGET_LINK_LIBRARIES(pcretest ${PCRETEST_LIBS})
596    
597      IF(PCRE_SUPPORT_JIT)
598        ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
599        SET(targets ${targets} pcre_jit_test)
600        SET(PCRE_JIT_TEST_LIBS )
601        IF(PCRE_BUILD_PCRE8)
602          LIST(APPEND PCRE_JIT_TEST_LIBS pcre)
603        ENDIF(PCRE_BUILD_PCRE8)
604        IF(PCRE_BUILD_PCRE16)
605          LIST(APPEND PCRE_JIT_TEST_LIBS pcre16)
606        ENDIF(PCRE_BUILD_PCRE16)
607        TARGET_LINK_LIBRARIES(pcre_jit_test ${PCRE_JIT_TEST_LIBS})
608      ENDIF(PCRE_SUPPORT_JIT)
609    
610      IF(PCRE_BUILD_PCRECPP)
611        ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc)
612        SET(targets ${targets} pcrecpp_unittest)
613        TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp)
614        IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
615          SET_TARGET_PROPERTIES(pcrecpp
616                            PROPERTIES PREFIX ""
617          )
618        ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC)
619    
620          ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)      ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc)
621          TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)      SET(targets ${targets} pcre_scanner_unittest)
622  ENDIF(PCRE_BUILD_PCRECPP)      TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp)
623    
624        ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc)
625        SET(targets ${targets} pcre_stringpiece_unittest)
626        TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
627      ENDIF(PCRE_BUILD_PCRECPP)
628    
629      # exes in Debug location tested by the RunTest shell script
630      # via "make test"
631      IF(PCRE_BUILD_PCREGREP)
632        GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)
633      ENDIF(PCRE_BUILD_PCREGREP)
634    
635      GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
636    
637    # =================================================
638      # Write out a CTest configuration file
639      #
640      FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
641      "# This is a generated file.
642    MESSAGE(\"When testing is complete, review test output in the
643    ${PROJECT_BINARY_DIR}/Testing/Temporary folder.\")
644    MESSAGE(\"\")
645    ")
646    
647  # Testing    FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.sh
648      "#! /bin/sh
649    # This is a generated file.
650    srcdir=${PROJECT_SOURCE_DIR}
651    pcretest=${PCRETEST_EXE}
652    source ${PROJECT_SOURCE_DIR}/RunTest
653    if test \"$?\" != \"0\"; then exit 1; fi
654    # End
655    ")
656    
657  ENABLE_TESTING()    IF(UNIX)
658        ADD_TEST(pcre_test      sh ${PROJECT_BINARY_DIR}/pcre_test.sh)
659      ENDIF(UNIX)
660    
661      IF(PCRE_BUILD_PCREGREP)
662        FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_grep_test.sh
663        "#! /bin/sh
664    # This is a generated file.
665    srcdir=${PROJECT_SOURCE_DIR}
666    pcregrep=${PCREGREP_EXE}
667    pcretest=${PCRETEST_EXE}
668    source ${PROJECT_SOURCE_DIR}/RunGrepTest
669    if test \"$?\" != \"0\"; then exit 1; fi
670    # End
671    ")
672    
673  GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)      IF(UNIX)
674  GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)        ADD_TEST(pcre_grep_test sh ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
675        ENDIF(UNIX)
676      ENDIF(PCRE_BUILD_PCREGREP)
677    
678      IF(WIN32)
679        # Provide environment for executing the bat file version of RunTest
680        string(REPLACE "/" "\\" winsrc "${PROJECT_SOURCE_DIR}")
681    
682        FILE(WRITE ${PROJECT_BINARY_DIR}/pcre_test.txt
683        "\@REM This is a generated file.
684    \@Echo off
685    setlocal
686    SET\ srcdir=\${srcdir}
687    SET\ pcretest=\${pcretest}
688    call \"\${srcdir}\\RunTest.Bat\"
689    if errorlevel 1 exit /b 1
690    echo RunTest.bat tests successfully completed
691    ")
692    
693  # Write out a CTest configuration file that sets some needed environment    FILE(WRITE ${PROJECT_BINARY_DIR}/BatDriver.cmake
694  # variables for the test scripts.    "# This is a generated file.
695  #  # this script is run with arguments via the cmake command in add_test(NAME pcre_test_bat)
696  FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest  # BatDriver feeds the actual location of pcretest.exe
697  "# This is a generated file.  FILE(TO_NATIVE_PATH \${pcretestx} pcretest)
698  SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})  FILE(TO_NATIVE_PATH \${srcdirx} srcdir)
699  SET(ENV{pcregrep} ${PCREGREP_EXE})  configure_file(\"\${bindirx}/pcre_test.txt\" \"\${bindirx}/pcre_test.bat\")
700  SET(ENV{pcretest} ${PCRETEST_EXE})  # MESSAGE(\"cmake\ variable\ pcretest\ is\ \${pcretest}\")
701    # STRING(REPLACE \" \" \"\\ \" bindir \${bindirx})
702    MESSAGE(\"COMMAND pcre_test.bat \")
703    EXECUTE_PROCESS(COMMAND pcre_test.bat
704    WORKING_DIRECTORY .
705    OUTPUT_VARIABLE batoutput)
706    MESSAGE(\"OUTPUT: \${batoutput}\")
707  ")  ")
708    
709  IF(UNIX)    ADD_TEST(NAME pcre_test_bat
710          ADD_TEST(pcre_test      ${PROJECT_SOURCE_DIR}/RunTest)    COMMAND ${CMAKE_COMMAND} -D bindirx=${PROJECT_BINARY_DIR} -D srcdirx=${PROJECT_SOURCE_DIR} -D pcretestx=$<TARGET_FILE:pcretest> -P "${PROJECT_BINARY_DIR}/BatDriver.cmake")
711          ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest)    SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
712  ENDIF(UNIX)    PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
713  IF(WIN32)  
714          ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)      IF("$ENV{OSTYPE}" STREQUAL "msys")
715  ENDIF(WIN32)        # Both the sh and bat file versions of RunTest are run if make test is used
716          # in msys
717          ADD_TEST(pcre_test_sh    sh.exe ${PROJECT_BINARY_DIR}/pcre_test.sh)
718          IF(PCRE_BUILD_PCREGREP)
719            ADD_TEST(pcre_grep_test  sh.exe ${PROJECT_BINARY_DIR}/pcre_grep_test.sh)
720          ENDIF(PCRE_BUILD_PCREGREP)
721        ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
722    
723      ENDIF(WIN32)
724    
725      # Changed to accommodate testing whichever location was just built
726    
727      IF(PCRE_SUPPORT_JIT)
728        ADD_TEST(pcre_jit_test         pcre_jit_test)
729      ENDIF(PCRE_SUPPORT_JIT)
730    
731      IF(PCRE_BUILD_PCRECPP)
732        ADD_TEST(pcrecpp_test          pcrecpp_unittest)
733        ADD_TEST(pcre_scanner_test     pcre_scanner_unittest)
734        ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
735      ENDIF(PCRE_BUILD_PCRECPP)
736    
737  GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE  ENDIF(PCRE_BUILD_TESTS)
                     pcrecpp_unittest  
                     DEBUG_LOCATION)  
   
 GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE  
                     pcre_scanner_unittest  
                     DEBUG_LOCATION)  
   
 GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE  
                     pcre_stringpiece_unittest  
                     DEBUG_LOCATION)  
   
 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})  
738    
739  # Installation  # Installation
   
740  SET(CMAKE_INSTALL_ALWAYS 1)  SET(CMAKE_INSTALL_ALWAYS 1)
741    
742  INSTALL(TARGETS pcre pcreposix pcregrep pcretest  INSTALL(TARGETS ${targets}
743          RUNTIME DESTINATION bin          RUNTIME DESTINATION bin
744          LIBRARY DESTINATION lib          LIBRARY DESTINATION lib
745          ARCHIVE DESTINATION lib)          ARCHIVE DESTINATION lib)
# Line 467  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc Line 751  FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc
751  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)  FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
752    
753  IF(PCRE_BUILD_PCRECPP)  IF(PCRE_BUILD_PCRECPP)
         INSTALL(TARGETS pcrecpp  
                 RUNTIME DESTINATION bin  
                 LIBRARY DESTINATION lib  
                 ARCHIVE DESTINATION lib)  
754          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)          INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
755  ELSE(PCRE_BUILD_PCRECPP)  ELSE(PCRE_BUILD_PCRECPP)
756          # Remove pcrecpp.3          # Remove pcrecpp.3
# Line 483  ELSE(PCRE_BUILD_PCRECPP) Line 763  ELSE(PCRE_BUILD_PCRECPP)
763          SET(man3 ${man3_new})          SET(man3 ${man3_new})
764  ENDIF(PCRE_BUILD_PCRECPP)  ENDIF(PCRE_BUILD_PCRECPP)
765    
   
766  INSTALL(FILES ${man1} DESTINATION man/man1)  INSTALL(FILES ${man1} DESTINATION man/man1)
767  INSTALL(FILES ${man3} DESTINATION man/man3)  INSTALL(FILES ${man3} DESTINATION man/man3)
768  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)  INSTALL(FILES ${html} DESTINATION share/doc/pcre/html)
# Line 495  ELSE(BUILD_SHARED_LIBS) Line 774  ELSE(BUILD_SHARED_LIBS)
774    SET(BUILD_STATIC_LIBS ON)    SET(BUILD_STATIC_LIBS ON)
775  ENDIF(BUILD_SHARED_LIBS)  ENDIF(BUILD_SHARED_LIBS)
776    
777  MESSAGE(STATUS "")  IF(PCRE_SHOW_REPORT)
778  MESSAGE(STATUS "")    STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
779  MESSAGE(STATUS "PCRE configuration summary:")    IF (CMAKE_C_FLAGS)
780  MESSAGE(STATUS "")      SET(cfsp " ")
781  MESSAGE(STATUS "  Install prefix .................. : " ${CMAKE_INSTALL_PREFIX})    ENDIF(CMAKE_C_FLAGS)
782  MESSAGE(STATUS "  C compiler ...................... : " ${CMAKE_C_COMPILER})    IF (CMAKE_CXX_FLAGS)
783  MESSAGE(STATUS "  C++ compiler .................... : " ${CMAKE_CXX_COMPILER})      SET(cxxfsp " ")
784  MESSAGE(STATUS "  C compiler flags ................ : " ${CMAKE_C_FLAGS})   #FIXME    ENDIF(CMAKE_CXX_FLAGS)
785  MESSAGE(STATUS "  C++ compiler flags .............. : " ${CMAKE_CXX_FLAGS}) #FIXME    MESSAGE(STATUS "")
786  MESSAGE(STATUS "")    MESSAGE(STATUS "")
787  MESSAGE(STATUS "  Build C++ library ............... : " ${PCRE_BUILD_PCRECPP})    MESSAGE(STATUS "PCRE configuration summary:")
788  MESSAGE(STATUS "  Enable UTF-8 support ............ : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})    MESSAGE(STATUS "")
789  MESSAGE(STATUS "  Unicode properties .............. : " ${PCRE_SUPPORT_UNICODE_PROPERTIES})    MESSAGE(STATUS "  Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
790  MESSAGE(STATUS "  Newline char/sequence ........... : " ${PCRE_NEWLINE})    MESSAGE(STATUS "  C compiler ...................... : ${CMAKE_C_COMPILER}")
791  MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : " ${PCRE_SUPPORT_BSR_ANYCRLF})    MESSAGE(STATUS "  C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
792  MESSAGE(STATUS "  EBCDIC coding ................... : " ${PCRE_EBCDIC})    MESSAGE(STATUS "  C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
793  MESSAGE(STATUS "  Rebuild char tables ............. : " ${PCRE_REBUILD_CHARTABLES})    MESSAGE(STATUS "  C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}")
794  MESSAGE(STATUS "  No stack recursion .............. : " ${PCRE_NO_RECURSE})    MESSAGE(STATUS "")
795  MESSAGE(STATUS "  POSIX mem threshold ............. : " ${PCRE_POSIX_MALLOC_THRESHOLD})    MESSAGE(STATUS "  Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
796  MESSAGE(STATUS "  Internal link size .............. : " ${PCRE_LINK_SIZE})    MESSAGE(STATUS "  Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
797  MESSAGE(STATUS "  Match limit ..................... : " ${PCRE_MATCH_LIMIT})    MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
798  MESSAGE(STATUS "  Match limit recursion ........... : " ${PCRE_MATCH_LIMIT_RECURSION})    MESSAGE(STATUS "  Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
799  MESSAGE(STATUS "  Build shared libs ............... : " ${BUILD_SHARED_LIBS})    MESSAGE(STATUS "  Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
800  MESSAGE(STATUS "  Build static libs ............... : " ${BUILD_STATIC_LIBS})    MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
801  IF(ZLIB_FOUND)    MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")
802    MESSAGE(STATUS "  Link pcregrep with libz ......... : " ${PCRE_SUPPORT_LIBZ})    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
803  ELSE(ZLIB_FOUND)    MESSAGE(STATUS "  EBCDIC coding ................... : ${PCRE_EBCDIC}")
804    MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )    MESSAGE(STATUS "  Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
805  ENDIF(ZLIB_FOUND)    MESSAGE(STATUS "  No stack recursion .............. : ${PCRE_NO_RECURSE}")
806  IF(BZIP2_FOUND)    MESSAGE(STATUS "  POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
807    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : " ${PCRE_SUPPORT_LIBBZ2})    MESSAGE(STATUS "  Internal link size .............. : ${PCRE_LINK_SIZE}")
808  ELSE(BZIP2_FOUND)    MESSAGE(STATUS "  Match limit ..................... : ${PCRE_MATCH_LIMIT}")
809    MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )    MESSAGE(STATUS "  Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
810  ENDIF(BZIP2_FOUND)    MESSAGE(STATUS "  Build shared libs ............... : ${BUILD_SHARED_LIBS}")
811  IF(NOT PCRE_SUPPORT_LIBREADLINE)    MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")
812    MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )    MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
813  ELSE(NOT PCRE_SUPPORT_LIBREADLINE)    MESSAGE(STATUS "  Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
814    MESSAGE(STATUS "  Link pcretest with libreadline .. : " ${PCRE_SUPPORT_LIBREADLINE})    MESSAGE(STATUS "  Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
815  ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)    MESSAGE(STATUS "  Build tests (implies pcretest  .. : ${PCRE_BUILD_TESTS}")
816  IF(MINGW AND NOT PCRE_STATIC)    MESSAGE(STATUS "               and pcregrep)")
817    MESSAGE(STATUS "  Non-standard dll names (prefix) . : " ${NON_STANDARD_LIB_PREFIX})    IF(ZLIB_FOUND)
818    MESSAGE(STATUS "  Non-standard dll names (suffix) . : " ${NON_STANDARD_LIB_SUFFIX})      MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
819  ENDIF(MINGW AND NOT PCRE_STATIC)    ELSE(ZLIB_FOUND)
820  MESSAGE(STATUS "")      MESSAGE(STATUS "  Link pcregrep with libz ......... : None" )
821      ENDIF(ZLIB_FOUND)
822      IF(BZIP2_FOUND)
823        MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}")
824      ELSE(BZIP2_FOUND)
825        MESSAGE(STATUS "  Link pcregrep with libbz2 ....... : None" )
826      ENDIF(BZIP2_FOUND)
827      IF(NOT PCRE_SUPPORT_LIBREADLINE)
828        MESSAGE(STATUS "  Link pcretest with libreadline .. : None" )
829      ELSE(NOT PCRE_SUPPORT_LIBREADLINE)
830        MESSAGE(STATUS "  Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}")
831      ENDIF(NOT PCRE_SUPPORT_LIBREADLINE)
832      IF(MINGW AND NOT PCRE_STATIC)
833        MESSAGE(STATUS "  Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
834        MESSAGE(STATUS "  Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
835      ENDIF(MINGW AND NOT PCRE_STATIC)
836      MESSAGE(STATUS "")
837    ENDIF(PCRE_SHOW_REPORT)
838    
839  # end CMakeLists.txt  # end CMakeLists.txt

Legend:
Removed from v.405  
changed lines
  Added in v.886

  ViewVC Help
Powered by ViewVC 1.1.5