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