38 |
# (Note: CMakeSetup displays these in alphabetical order, regardless of |
# (Note: CMakeSetup displays these in alphabetical order, regardless of |
39 |
# the order we use here) |
# the order we use here) |
40 |
|
|
41 |
SET(BUILD_SHARED_LIBS "SHARED" CACHE STRING |
SET(BUILD_SHARED_LIBS OFF CACHE BOOL |
42 |
"What type of libraries to build. Set to SHARED or STATIC.") |
"Build shared libraries instead of static ones.") |
43 |
|
|
44 |
OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON) |
OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON) |
45 |
|
|
46 |
SET(PCRE_EBCDIC FALSE CACHE BOOL |
SET(PCRE_EBCDIC OFF CACHE BOOL |
47 |
"Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)") |
"Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)") |
48 |
|
|
49 |
SET(PCRE_LINK_SIZE "2" CACHE STRING |
SET(PCRE_LINK_SIZE "2" CACHE STRING |
58 |
SET(PCRE_NEWLINE "LF" CACHE STRING |
SET(PCRE_NEWLINE "LF" CACHE STRING |
59 |
"What to recognize as a newline (one of CR, LF, CRLF, ANY).") |
"What to recognize as a newline (one of CR, LF, CRLF, ANY).") |
60 |
|
|
61 |
SET(PCRE_NO_RECURSE TRUE CACHE BOOL |
SET(PCRE_NO_RECURSE ON CACHE BOOL |
62 |
"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.") |
63 |
|
|
64 |
SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING |
SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING |
65 |
"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.") |
66 |
|
|
67 |
SET(PCRE_SUPPORT_UNICODE_PROPERTIES FALSE CACHE BOOL |
SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL |
68 |
"Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)") |
"Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)") |
69 |
|
|
70 |
SET(PCRE_SUPPORT_UTF8 FALSE CACHE BOOL |
SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL |
71 |
"Enable support for the Unicode UTF-8 encoding.") |
"Enable support for the Unicode UTF-8 encoding.") |
72 |
|
|
73 |
# Prepare build configuration |
# Prepare build configuration |
94 |
SET(pcre_have_ulong_long 1) |
SET(pcre_have_ulong_long 1) |
95 |
ENDIF(HAVE_UNSIGNED_LONG_LONG) |
ENDIF(HAVE_UNSIGNED_LONG_LONG) |
96 |
|
|
97 |
|
IF(NOT BUILD_SHARED_LIBS) |
98 |
|
SET(PCRE_STATIC 1) |
99 |
|
ENDIF(NOT BUILD_SHARED_LIBS) |
100 |
|
|
101 |
IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
102 |
SET(SUPPORT_UTF8 1) |
SET(SUPPORT_UTF8 1) |
103 |
ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) |
106 |
SET(SUPPORT_UCP 1) |
SET(SUPPORT_UCP 1) |
107 |
ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) |
ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) |
108 |
|
|
109 |
|
SET(NEWLINE "") |
110 |
|
|
111 |
IF(PCRE_NEWLINE STREQUAL "LF") |
IF(PCRE_NEWLINE STREQUAL "LF") |
112 |
SET(NEWLINE "10") |
SET(NEWLINE "10") |
113 |
ELSE(PCRE_NEWLINE STREQUAL "LF") |
ENDIF(PCRE_NEWLINE STREQUAL "LF") |
114 |
IF(PCRE_NEWLINE STREQUAL "CR") |
IF(PCRE_NEWLINE STREQUAL "CR") |
115 |
SET(NEWLINE "13") |
SET(NEWLINE "13") |
116 |
ELSE(PCRE_NEWLINE STREQUAL "CR") |
ENDIF(PCRE_NEWLINE STREQUAL "CR") |
117 |
IF(PCRE_NEWLINE STREQUAL "CRLF") |
IF(PCRE_NEWLINE STREQUAL "CRLF") |
118 |
SET(NEWLINE "3338") |
SET(NEWLINE "3338") |
119 |
ELSE(PCRE_NEWLINE STREQUAL "CRLF") |
ENDIF(PCRE_NEWLINE STREQUAL "CRLF") |
120 |
IF(PCRE_NEWLINE STREQUAL "ANY") |
IF(PCRE_NEWLINE STREQUAL "ANY") |
121 |
SET(NEWLINE "-1") |
SET(NEWLINE "-1") |
122 |
ELSE(PCRE_NEWLINE STREQUAL "ANY") |
ENDIF(PCRE_NEWLINE STREQUAL "ANY") |
123 |
|
|
124 |
|
IF(NEWLINE STREQUAL "") |
125 |
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\".") |
126 |
ENDIF(PCRE_NEWLINE STREQUAL "ANY") |
ENDIF(NEWLINE STREQUAL "") |
|
ENDIF(PCRE_NEWLINE STREQUAL "CRLF") |
|
|
ENDIF(PCRE_NEWLINE STREQUAL "CR") |
|
|
ENDIF(PCRE_NEWLINE STREQUAL "LF") |
|
127 |
|
|
128 |
IF(PCRE_EBCDIC) |
IF(PCRE_EBCDIC) |
129 |
SET(EBCDIC 1) |
SET(EBCDIC 1) |
249 |
ADD_EXECUTABLE(pcregrep pcregrep.c) |
ADD_EXECUTABLE(pcregrep pcregrep.c) |
250 |
TARGET_LINK_LIBRARIES(pcregrep pcreposix) |
TARGET_LINK_LIBRARIES(pcregrep pcreposix) |
251 |
|
|
252 |
|
IF(PCRE_BUILD_PCRECPP) |
253 |
|
ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc) |
254 |
|
TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp) |
255 |
|
|
256 |
|
ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc) |
257 |
|
TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp) |
258 |
|
|
259 |
|
ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc) |
260 |
|
TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp) |
261 |
|
ENDIF(PCRE_BUILD_PCRECPP) |
262 |
|
|
263 |
# Testing |
# Testing |
264 |
|
|
265 |
ENABLE_TESTING() |
ENABLE_TESTING() |
266 |
|
|
267 |
|
GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION) |
268 |
|
GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION) |
269 |
|
|
270 |
|
# Write out a CTest configuration file that sets some needed environment |
271 |
|
# variables for the test scripts. |
272 |
|
# |
273 |
|
FILE(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.ctest |
274 |
|
"# This is a generated file. |
275 |
|
SET(ENV{srcdir} ${CMAKE_SOURCE_DIR}) |
276 |
|
SET(ENV{pcregrep} ${PCREGREP_EXE}) |
277 |
|
SET(ENV{pcretest} ${PCRETEST_EXE}) |
278 |
|
") |
279 |
|
|
280 |
IF(UNIX) |
IF(UNIX) |
281 |
ADD_TEST(test1 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunTest") |
ADD_TEST(pcre_test ${CMAKE_SOURCE_DIR}/RunTest) |
282 |
ADD_TEST(test2 sh -c "srcdir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/RunGrepTest") |
ADD_TEST(pcre_grep_test ${CMAKE_SOURCE_DIR}/RunGrepTest) |
|
ELSE(UNIX) |
|
|
IF(WIN32) |
|
|
ADD_TEST(test1 ${CMAKE_SOURCE_DIR}/RunTest.bat ${CMAKE_SOURCE_DIR}) |
|
|
ENDIF(WIN32) |
|
283 |
ENDIF(UNIX) |
ENDIF(UNIX) |
284 |
|
IF(WIN32) |
285 |
|
ADD_TEST(pcre_test cmd /C ${CMAKE_SOURCE_DIR}/RunTest.bat) |
286 |
|
ENDIF(WIN32) |
287 |
|
|
288 |
|
GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE |
289 |
|
pcrecpp_unittest |
290 |
|
DEBUG_LOCATION) |
291 |
|
|
292 |
|
GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE |
293 |
|
pcre_scanner_unittest |
294 |
|
DEBUG_LOCATION) |
295 |
|
|
296 |
|
GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE |
297 |
|
pcre_stringpiece_unittest |
298 |
|
DEBUG_LOCATION) |
299 |
|
|
300 |
|
ADD_TEST(pcrecpp_test ${PCRECPP_UNITTEST_EXE}) |
301 |
|
ADD_TEST(pcre_scanner_test ${PCRE_SCANNER_UNITTEST_EXE}) |
302 |
|
ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE}) |
303 |
|
|
304 |
# Installation |
# Installation |
305 |
|
|