/[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 698 by ph10, Mon Sep 19 15:43:02 2011 UTC revision 886 by ph10, Tue Jan 17 14:25:07 2012 UTC
# Line 41  Line 41 
41  # 2011-08-22 PH added PCRE_SUPPORT_JIT  # 2011-08-22 PH added PCRE_SUPPORT_JIT
42  # 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov  # 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov
43  # 2011-09-06 PH added PCRE_SUPPORT_PCREGREP_JIT  # 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 89  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 121  SET(PCRE_SUPPORT_JIT OFF CACHE BOOL Line 142  SET(PCRE_SUPPORT_JIT OFF CACHE BOOL
142  SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL  SET(PCRE_SUPPORT_PCREGREP_JIT ON CACHE BOOL
143      "Enable use of Just-in-time compiling in pcregrep.")      "Enable use of Just-in-time compiling in pcregrep.")
144    
145  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL  SET(PCRE_SUPPORT_UTF OFF CACHE BOOL
146      "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)")      "Enable support for Unicode Transformation Format (UTF-8 and/or UTF-16) encoding.")
147    
148  SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL  SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL
149      "Enable support for the Unicode UTF-8 encoding.")      "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")
# Line 134  OPTION(PCRE_SHOW_REPORT    "Show the fin Line 155  OPTION(PCRE_SHOW_REPORT    "Show the fin
155  OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)  OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON)
156  OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)  OPTION(PCRE_BUILD_TESTS    "Build the tests" ON)
157    
 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)  
   
158  IF (MINGW)  IF (MINGW)
159    OPTION(NON_STANDARD_LIB_PREFIX    OPTION(NON_STANDARD_LIB_PREFIX
160           "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 203  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)
# Line 279  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 320  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 329  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
   pcre_info.c  
391    pcre_jit_compile.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 348  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 380  SET(targets) Line 490  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)  SET(targets ${targets} pcre)
496  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})  ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES})
497  SET(targets ${targets} pcreposix)  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 399  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  SET(targets ${targets} pcrecpp)  SET(targets ${targets} pcrecpp)
540    TARGET_LINK_LIBRARIES(pcrecpp pcre)  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 439  IF(PCRE_BUILD_PCREGREP) Line 572  IF(PCRE_BUILD_PCREGREP)
572    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})    TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS})
573  ENDIF(PCRE_BUILD_PCREGREP)  ENDIF(PCRE_BUILD_PCREGREP)
574    
   
575  # Testing  # Testing
576  IF(PCRE_BUILD_TESTS)  IF(PCRE_BUILD_TESTS)
577    ENABLE_TESTING()    ENABLE_TESTING()
578    
579    ADD_EXECUTABLE(pcretest pcretest.c)    SET(PCRETEST_SOURCES pcretest.c)
580      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)    SET(targets ${targets} pcretest)
589    TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS})    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)    IF(PCRE_SUPPORT_JIT)
598      ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)      ADD_EXECUTABLE(pcre_jit_test pcre_jit_test.c)
599      SET(targets ${targets} pcre_jit_test)      SET(targets ${targets} pcre_jit_test)
600      TARGET_LINK_LIBRARIES(pcre_jit_test pcre)      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)    ENDIF(PCRE_SUPPORT_JIT)
609    
610    IF(PCRE_BUILD_PCRECPP)    IF(PCRE_BUILD_PCRECPP)
# Line 473  IF(PCRE_BUILD_TESTS) Line 626  IF(PCRE_BUILD_TESTS)
626      TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)      TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp)
627    ENDIF(PCRE_BUILD_PCRECPP)    ENDIF(PCRE_BUILD_PCRECPP)
628    
629    GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION)    # 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)    GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION)
636    
637    # Write out a CTest configuration file that sets some needed environment  # =================================================
638    # variables for the test scripts.    # Write out a CTest configuration file
639    #    #
640    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest    FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
641    "# This is a generated file.    "# This is a generated file.
642    SET(ENV{srcdir} ${PROJECT_SOURCE_DIR})  MESSAGE(\"When testing is complete, review test output in the
643    SET(ENV{pcregrep} ${PCREGREP_EXE})  ${PROJECT_BINARY_DIR}/Testing/Temporary folder.\")
644    SET(ENV{pcretest} ${PCRETEST_EXE})  MESSAGE(\"\")
645    ")  ")
646    
647      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    IF(UNIX)    IF(UNIX)
658            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)  
659    ENDIF(UNIX)    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        IF(UNIX)
674          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)    IF(WIN32)
679            # ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat)      # Provide environment for executing the bat file version of RunTest
680            ADD_TEST(pcre_test ${PROJECT_SOURCE_DIR}/RunTest.bat)      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      FILE(WRITE ${PROJECT_BINARY_DIR}/BatDriver.cmake
694      "# This is a generated file.
695    # this script is run with arguments via the cmake command in add_test(NAME pcre_test_bat)
696    # BatDriver feeds the actual location of pcretest.exe
697    FILE(TO_NATIVE_PATH \${pcretestx} pcretest)
698    FILE(TO_NATIVE_PATH \${srcdirx} srcdir)
699    configure_file(\"\${bindirx}/pcre_test.txt\" \"\${bindirx}/pcre_test.bat\")
700    # 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      ADD_TEST(NAME pcre_test_bat
710      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      SET_TESTS_PROPERTIES(pcre_test_bat PROPERTIES
712      PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
713    
714        IF("$ENV{OSTYPE}" STREQUAL "msys")
715          # 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)    ENDIF(WIN32)
724    
725      # Changed to accommodate testing whichever location was just built
726    
727    IF(PCRE_SUPPORT_JIT)    IF(PCRE_SUPPORT_JIT)
728    GET_TARGET_PROPERTY(PCRE_JIT_TEST_EXE      ADD_TEST(pcre_jit_test         pcre_jit_test)
                       pcre_jit_test  
                       DEBUG_LOCATION)  
729    ENDIF(PCRE_SUPPORT_JIT)    ENDIF(PCRE_SUPPORT_JIT)
730    
731    GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE    IF(PCRE_BUILD_PCRECPP)
732                        pcrecpp_unittest      ADD_TEST(pcrecpp_test          pcrecpp_unittest)
733                        DEBUG_LOCATION)      ADD_TEST(pcre_scanner_test     pcre_scanner_unittest)
734        ADD_TEST(pcre_stringpiece_test pcre_stringpiece_unittest)
735    GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE    ENDIF(PCRE_BUILD_PCRECPP)
                       pcre_scanner_unittest  
                       DEBUG_LOCATION)  
   
   GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE  
                       pcre_stringpiece_unittest  
                       DEBUG_LOCATION)  
736    
   IF(PCRE_SUPPORT_JIT)  
   ADD_TEST(pcre_jit_test         ${PCRE_JIT_TEST_EXE})  
   ENDIF(PCRE_SUPPORT_JIT)  
   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})  
737  ENDIF(PCRE_BUILD_TESTS)  ENDIF(PCRE_BUILD_TESTS)
738    
739  # Installation  # Installation
# Line 548  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 578  IF(PCRE_SHOW_REPORT) Line 792  IF(PCRE_SHOW_REPORT)
792    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}}")
793    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}}")
794    MESSAGE(STATUS "")    MESSAGE(STATUS "")
795      MESSAGE(STATUS "  Build 8 bit PCRE library ........ : ${PCRE_BUILD_PCRE8}")
796      MESSAGE(STATUS "  Build 16 bit PCRE library ....... : ${PCRE_BUILD_PCRE16}")
797    MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")    MESSAGE(STATUS "  Build C++ library ............... : ${PCRE_BUILD_PCRECPP}")
798    MESSAGE(STATUS "  Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")    MESSAGE(STATUS "  Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
799    MESSAGE(STATUS "  Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")    MESSAGE(STATUS "  Enable UTF support .............. : ${PCRE_SUPPORT_UTF}")
800    MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")    MESSAGE(STATUS "  Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
801    MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")    MESSAGE(STATUS "  Newline char/sequence ........... : ${PCRE_NEWLINE}")
802    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")    MESSAGE(STATUS "  \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
# Line 596  IF(PCRE_SHOW_REPORT) Line 812  IF(PCRE_SHOW_REPORT)
812    MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")    MESSAGE(STATUS "  Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
813    MESSAGE(STATUS "  Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")    MESSAGE(STATUS "  Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
814    MESSAGE(STATUS "  Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")    MESSAGE(STATUS "  Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
815    MESSAGE(STATUS "  Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}")    MESSAGE(STATUS "  Build tests (implies pcretest  .. : ${PCRE_BUILD_TESTS}")
816      MESSAGE(STATUS "               and pcregrep)")
817    IF(ZLIB_FOUND)    IF(ZLIB_FOUND)
818      MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")      MESSAGE(STATUS "  Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}")
819    ELSE(ZLIB_FOUND)    ELSE(ZLIB_FOUND)

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

  ViewVC Help
Powered by ViewVC 1.1.5