--- code/trunk/CMakeLists.txt 2007/08/01 09:10:40 200 +++ code/trunk/CMakeLists.txt 2007/12/27 09:27:23 292 @@ -1,10 +1,18 @@ # CMakeLists.txt # +# # This file allows building PCRE with the CMake configuration and build # tool. Download CMake in source or binary form from http://www.cmake.org/ # # Original listfile by Christian Ehrlicher # Refined and expanded by Daniel Richard G. +# 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered +# 2007-09-19 Adjusted by PH to retain previous default settings +# 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre +# (b) Ensure pcretest and pcregrep link with the local library, +# not a previously-installed one. +# (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and +# PCRE_SUPPORT_LIBBZ2. # PROJECT(PCRE C CXX) @@ -23,6 +31,11 @@ CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE(bzlib.h HAVE_BZLIB_H) +CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H) +CHECK_INCLUDE_FILE(readline/history.h HAVE_READLINE_HISTORY_H) +CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_READLINE_H) + CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H) CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H) @@ -56,7 +69,7 @@ "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.") SET(PCRE_NEWLINE "LF" CACHE STRING - "What to recognize as a newline (one of CR, LF, CRLF, ANY).") + "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).") SET(PCRE_NO_RECURSE OFF CACHE BOOL "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.") @@ -70,6 +83,18 @@ SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL "Enable support for the Unicode UTF-8 encoding.") +SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL + "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks") + +SET(PCRE_SUPPORT_LIBBZ2 OFF CACHE BOOL + "Enable support for linking pcregrep with libbz2.") + +SET (PCRE_SUPPORT_LIBZ OFF CACHE BOOL + "Enable support for linking pcregrep with libz.") + +SET (PCRE_SUPPORT_LIBREADLINE OFF CACHE BOOL + "Enable support for linking pcretest with libreadline.") + # Prepare build configuration SET(pcre_have_type_traits 0) @@ -98,6 +123,10 @@ SET(PCRE_STATIC 1) ENDIF(NOT BUILD_SHARED_LIBS) +IF(PCRE_SUPPORT_BSR_ANYCRLF) + SET(BSR_ANYCRLF 1) +ENDIF(PCRE_SUPPORT_BSR_ANYCRLF) + IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) SET(SUPPORT_UTF8 1) ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) @@ -106,6 +135,21 @@ SET(SUPPORT_UCP 1) ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) +IF(PCRE_SUPPORT_LIBREADLINE) + SET(SUPPORT_LIBREADLINE 1) + SET(PCRETEST_LIBS readline) +ENDIF(PCRE_SUPPORT_LIBREADLINE) + +IF(PCRE_SUPPORT_LIBZ) + SET(SUPPORT_LIBZ 1) + SET(PCREGREP_LIBS z) +ENDIF(PCRE_SUPPORT_LIBZ) + +IF(PCRE_SUPPORT_LIBBZ2) + SET(SUPPORT_LIBBZ2 1) + SET(PCREGREP_LIBS ${PCREGREP_LIBS} bz2) +ENDIF(PCRE_SUPPORT_LIBBZ2) + SET(NEWLINE "") IF(PCRE_NEWLINE STREQUAL "LF") @@ -120,9 +164,12 @@ IF(PCRE_NEWLINE STREQUAL "ANY") SET(NEWLINE "-1") ENDIF(PCRE_NEWLINE STREQUAL "ANY") +IF(PCRE_NEWLINE STREQUAL "ANYCRLF") + SET(NEWLINE "-2") +ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF") IF(NEWLINE STREQUAL "") - MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\".") + MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".") ENDIF(NEWLINE STREQUAL "") IF(PCRE_EBCDIC) @@ -232,6 +279,12 @@ ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES}) TARGET_LINK_LIBRARIES(pcreposix pcre) +IF(NOT UNIX) +SET_TARGET_PROPERTIES(pcre pcreposix + PROPERTIES PREFIX "" +) +ENDIF(NOT UNIX) + IF(PCRE_BUILD_PCRECPP) ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES}) TARGET_LINK_LIBRARIES(pcrecpp pcre) @@ -243,10 +296,10 @@ # Executables ADD_EXECUTABLE(pcretest pcretest.c) -TARGET_LINK_LIBRARIES(pcretest pcreposix) +TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS}) ADD_EXECUTABLE(pcregrep pcregrep.c) -TARGET_LINK_LIBRARIES(pcregrep pcreposix) +TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS}) IF(PCRE_BUILD_PCRECPP) ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc) @@ -317,9 +370,9 @@ IF(PCRE_BUILD_PCRECPP) INSTALL(TARGETS pcrecpp - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include) ELSE(PCRE_BUILD_PCRECPP) # Remove pcrecpp.3