1 |
# CMakeLists.txt |
# CMakeLists.txt |
2 |
# |
# |
3 |
|
# |
4 |
# This file allows building PCRE with the CMake configuration and build |
# 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/ |
# tool. Download CMake in source or binary form from http://www.cmake.org/ |
6 |
# |
# |
7 |
# Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de> |
# Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de> |
8 |
# Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG> |
# Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG> |
9 |
|
# 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 |
|
# 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 |
# |
# |
17 |
|
|
18 |
PROJECT(PCRE C CXX) |
PROJECT(PCRE C CXX) |
31 |
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) |
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) |
32 |
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) |
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) |
33 |
|
|
34 |
|
CHECK_INCLUDE_FILE(bzlib.h HAVE_BZLIB_H) |
35 |
|
CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H) |
36 |
|
CHECK_INCLUDE_FILE(readline/history.h HAVE_READLINE_HISTORY_H) |
37 |
|
CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_READLINE_H) |
38 |
|
|
39 |
CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H) |
CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H) |
40 |
CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H) |
CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H) |
41 |
|
|
69 |
"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.") |
70 |
|
|
71 |
SET(PCRE_NEWLINE "LF" CACHE STRING |
SET(PCRE_NEWLINE "LF" CACHE STRING |
72 |
"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).") |
73 |
|
|
74 |
SET(PCRE_NO_RECURSE OFF CACHE BOOL |
SET(PCRE_NO_RECURSE OFF CACHE BOOL |
75 |
"If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.") |
"If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.") |
83 |
SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL |
SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL |
84 |
"Enable support for the Unicode UTF-8 encoding.") |
"Enable support for the Unicode UTF-8 encoding.") |
85 |
|
|
86 |
|
SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL |
87 |
|
"ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks") |
88 |
|
|
89 |
|
SET(PCRE_SUPPORT_LIBBZ2 OFF CACHE BOOL |
90 |
|
"Enable support for linking pcregrep with libbz2.") |
91 |
|
|
92 |
|
SET (PCRE_SUPPORT_LIBZ OFF CACHE BOOL |
93 |
|
"Enable support for linking pcregrep with libz.") |
94 |
|
|
95 |
|
SET (PCRE_SUPPORT_LIBREADLINE OFF CACHE BOOL |
96 |
|
"Enable support for linking pcretest with libreadline.") |
97 |
|
|
98 |
# Prepare build configuration |
# Prepare build configuration |
99 |
|
|
100 |
SET(pcre_have_type_traits 0) |
SET(pcre_have_type_traits 0) |
123 |
SET(PCRE_STATIC 1) |
SET(PCRE_STATIC 1) |
124 |
ENDIF(NOT BUILD_SHARED_LIBS) |
ENDIF(NOT BUILD_SHARED_LIBS) |
125 |
|
|
126 |
|
IF(PCRE_SUPPORT_BSR_ANYCRLF) |
127 |
|
SET(BSR_ANYCRLF 1) |
128 |
|
ENDIF(PCRE_SUPPORT_BSR_ANYCRLF) |
129 |
|
|
130 |
IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
131 |
SET(SUPPORT_UTF8 1) |
SET(SUPPORT_UTF8 1) |
132 |
ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
135 |
SET(SUPPORT_UCP 1) |
SET(SUPPORT_UCP 1) |
136 |
ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) |
ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) |
137 |
|
|
138 |
|
IF(PCRE_SUPPORT_LIBREADLINE) |
139 |
|
SET(SUPPORT_LIBREADLINE 1) |
140 |
|
SET(PCRETEST_LIBS readline) |
141 |
|
ENDIF(PCRE_SUPPORT_LIBREADLINE) |
142 |
|
|
143 |
|
IF(PCRE_SUPPORT_LIBZ) |
144 |
|
SET(SUPPORT_LIBZ 1) |
145 |
|
SET(PCREGREP_LIBS z) |
146 |
|
ENDIF(PCRE_SUPPORT_LIBZ) |
147 |
|
|
148 |
|
IF(PCRE_SUPPORT_LIBBZ2) |
149 |
|
SET(SUPPORT_LIBBZ2 1) |
150 |
|
SET(PCREGREP_LIBS ${PCREGREP_LIBS} bz2) |
151 |
|
ENDIF(PCRE_SUPPORT_LIBBZ2) |
152 |
|
|
153 |
SET(NEWLINE "") |
SET(NEWLINE "") |
154 |
|
|
155 |
IF(PCRE_NEWLINE STREQUAL "LF") |
IF(PCRE_NEWLINE STREQUAL "LF") |
164 |
IF(PCRE_NEWLINE STREQUAL "ANY") |
IF(PCRE_NEWLINE STREQUAL "ANY") |
165 |
SET(NEWLINE "-1") |
SET(NEWLINE "-1") |
166 |
ENDIF(PCRE_NEWLINE STREQUAL "ANY") |
ENDIF(PCRE_NEWLINE STREQUAL "ANY") |
167 |
|
IF(PCRE_NEWLINE STREQUAL "ANYCRLF") |
168 |
|
SET(NEWLINE "-2") |
169 |
|
ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF") |
170 |
|
|
171 |
IF(NEWLINE STREQUAL "") |
IF(NEWLINE STREQUAL "") |
172 |
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\".") |
173 |
ENDIF(NEWLINE STREQUAL "") |
ENDIF(NEWLINE STREQUAL "") |
174 |
|
|
175 |
IF(PCRE_EBCDIC) |
IF(PCRE_EBCDIC) |
279 |
ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES}) |
ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES}) |
280 |
TARGET_LINK_LIBRARIES(pcreposix pcre) |
TARGET_LINK_LIBRARIES(pcreposix pcre) |
281 |
|
|
282 |
|
IF(NOT UNIX) |
283 |
|
SET_TARGET_PROPERTIES(pcre pcreposix |
284 |
|
PROPERTIES PREFIX "" |
285 |
|
) |
286 |
|
ENDIF(NOT UNIX) |
287 |
|
|
288 |
IF(PCRE_BUILD_PCRECPP) |
IF(PCRE_BUILD_PCRECPP) |
289 |
ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES}) |
ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES}) |
290 |
TARGET_LINK_LIBRARIES(pcrecpp pcre) |
TARGET_LINK_LIBRARIES(pcrecpp pcre) |
296 |
# Executables |
# Executables |
297 |
|
|
298 |
ADD_EXECUTABLE(pcretest pcretest.c) |
ADD_EXECUTABLE(pcretest pcretest.c) |
299 |
TARGET_LINK_LIBRARIES(pcretest pcreposix) |
TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS}) |
300 |
|
|
301 |
ADD_EXECUTABLE(pcregrep pcregrep.c) |
ADD_EXECUTABLE(pcregrep pcregrep.c) |
302 |
TARGET_LINK_LIBRARIES(pcregrep pcreposix) |
TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS}) |
303 |
|
|
304 |
IF(PCRE_BUILD_PCRECPP) |
IF(PCRE_BUILD_PCRECPP) |
305 |
ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc) |
ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc) |
370 |
|
|
371 |
IF(PCRE_BUILD_PCRECPP) |
IF(PCRE_BUILD_PCRECPP) |
372 |
INSTALL(TARGETS pcrecpp |
INSTALL(TARGETS pcrecpp |
373 |
RUNTIME DESTINATION bin |
RUNTIME DESTINATION bin |
374 |
LIBRARY DESTINATION lib |
LIBRARY DESTINATION lib |
375 |
ARCHIVE DESTINATION lib) |
ARCHIVE DESTINATION lib) |
376 |
INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include) |
INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include) |
377 |
ELSE(PCRE_BUILD_PCRECPP) |
ELSE(PCRE_BUILD_PCRECPP) |
378 |
# Remove pcrecpp.3 |
# Remove pcrecpp.3 |