github的一些开源项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1233 lines
47 KiB

  1. # CMakeLists.txt
  2. #
  3. # This file enables PCRE2 to be built with the CMake configuration and build
  4. # tool. Download CMake in source or binary form from http://www.cmake.org/
  5. # Converted to support PCRE2 from the original PCRE file, August 2014.
  6. #
  7. # Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
  8. # 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. # 2008-01-20 Brought up to date to include several new features by Christian
  17. # Ehrlicher.
  18. # 2008-01-22 Sheri added options for backward compatibility of library names
  19. # when 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
  22. # pcre.dll, 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. # 2008-01-23 PH removed the automatic build of pcredemo.
  28. # 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
  29. # 2008-07-03 PH updated for revised UCP property support (change of files)
  30. # 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name
  31. # CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
  32. # is included within another project.
  33. # 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to
  34. # add options to stop the building of pcregrep and the tests, and
  35. # to disable the final configuration report.
  36. # 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
  37. # are set by specifying a release type.
  38. # 2010-01-02 PH added test for stdint.h
  39. # 2010-03-02 PH added test for inttypes.h
  40. # 2011-08-01 PH added PCREGREP_BUFSIZE
  41. # 2011-08-22 PH added PCRE_SUPPORT_JIT
  42. # 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov
  43. # 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. # 2012-02-26 PH added support for libedit
  60. # 2012-09-06 PH added support for PCRE_EBCDIC_NL25
  61. # 2012-09-08 ChPe added PCRE32 support
  62. # 2012-10-23 PH added support for VALGRIND and GCOV
  63. # 2012-12-08 PH added patch from Daniel Richard G to quash some MSVC warnings
  64. # 2013-07-01 PH realized that the "support" for GCOV was a total nonsense and
  65. # so it has been removed.
  66. # 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
  67. # 2013-11-05 PH added support for PARENS_NEST_LIMIT
  68. # 2014-08-29 PH converted the file for PCRE2 (which has no C++).
  69. # 2015-04-24 PH added support for PCRE2_DEBUG
  70. # 2015-07-16 PH updated for new pcre2_find_bracket source module
  71. # 2015-08-24 PH correct C_FLAGS setting (patch from Roy Ivy III)
  72. # 2015-10=16 PH added support for never-backslash-C
  73. # 2016-03-01 PH applied Chris Wilson's patch for MSVC static
  74. # 2016-06-24 PH applied Chris Wilson's second patch, putting the first under
  75. # a new option instead of being unconditional.
  76. # 2016-10-05 PH fixed a typo (PCRE should be PCRE2) in above patch
  77. # fix by David Gaussmann
  78. # 2016-10-07 PH added PCREGREP_MAX_BUFSIZE
  79. # 2017-03-11 PH turned HEAP_MATCH_RECURSE into a NO-OP for 10.30
  80. # 2017-04-08 PH added HEAP_LIMIT
  81. # 2017-06-15 ZH added SUPPORT_JIT_SEALLOC support
  82. # 2018-06-19 PH added checks for stdint.h and inttypes.h (later removed)
  83. # 2018-06-27 PH added Daniel's patch to increase the stack for MSVC
  84. # 2018-11-14 PH removed unnecessary checks for stdint.h and inttypes.h
  85. # 2018-11-16 PH added PCRE2GREP_SUPPORT_CALLOUT_FORK support and tidied
  86. # 2019-02-16 PH hacked to avoid CMP0026 policy issue (see comments below)
  87. # 2020-03-16 PH renamed dftables as pcre2_dftables (as elsewhere)
  88. # 2020-03-24 PH changed CMAKE_MODULE_PATH definition to add, not replace
  89. # 2020-04-08 Carlo added function check for secure_getenv, fixed strerror
  90. # 2020-04-16 enh added check for __attribute__((uninitialized))
  91. # 2020-04-25 PH applied patches from Uwe Korn to support pkg-config and
  92. # library versioning.
  93. # 2020-04-25 Carlo added function check for mkostemp used in ProtExecAllocator
  94. # 2020-04-28 PH added function check for memfd_create based on Carlo's patch
  95. # 2020-05-25 PH added a check for Intel CET
  96. # 2020-12-03 PH altered the definition of pcre2test as suggested by Daniel
  97. # 2021-06-29 JWSB added the option to build static library with PIC.
  98. # 2021-07-05 JWSB modified such both the static and shared library can be
  99. # build in one go.
  100. # 2021-08-28 PH increased minimum version
  101. # 2021-08-28 PH added test for realpath()
  102. # 2022-12-10 PH added support for pcre2posix_test
  103. # 2023-01-15 Carlo added C99 as the minimum required
  104. # 2023-08-06 PH added support for setting variable length lookbehind maximum
  105. # Increased minimum to 3.5 to workaround deprecated backward compatibility
  106. # since 3.27.
  107. cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
  108. project(PCRE2 C)
  109. set(CMAKE_C_STANDARD 99)
  110. set(CMAKE_C_STANDARD_REQUIRED TRUE)
  111. set(CMAKE_C_VISIBILITY_PRESET hidden)
  112. cmake_policy(SET CMP0063 NEW)
  113. # Set policy CMP0026 to avoid warnings for the use of LOCATION in
  114. # GET_TARGET_PROPERTY. This should no longer be required.
  115. # CMAKE_POLICY(SET CMP0026 OLD)
  116. # With a recent cmake, you can provide a rootdir to look for non
  117. # standard installed library dependencies, but to do so, the policy
  118. # needs to be set to new (by uncommenting the following)
  119. # CMAKE_POLICY(SET CMP0074 NEW)
  120. # For FindReadline.cmake. This was changed to allow setting CMAKE_MODULE_PATH
  121. # on the command line.
  122. # SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  123. LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
  124. INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
  125. # external packages
  126. FIND_PACKAGE( BZip2 )
  127. FIND_PACKAGE( ZLIB )
  128. FIND_PACKAGE( Readline )
  129. FIND_PACKAGE( Editline )
  130. # Configuration checks
  131. INCLUDE(CheckCSourceCompiles)
  132. INCLUDE(CheckFunctionExists)
  133. INCLUDE(CheckSymbolExists)
  134. INCLUDE(CheckIncludeFile)
  135. INCLUDE(CheckTypeSize)
  136. INCLUDE(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR
  137. CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
  138. CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
  139. CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
  140. CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
  141. CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H)
  142. CHECK_SYMBOL_EXISTS(bcopy "strings.h" HAVE_BCOPY)
  143. CHECK_SYMBOL_EXISTS(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
  144. CHECK_SYMBOL_EXISTS(memmove "string.h" HAVE_MEMMOVE)
  145. CHECK_SYMBOL_EXISTS(secure_getenv "stdlib.h" HAVE_SECURE_GETENV)
  146. CHECK_SYMBOL_EXISTS(strerror "string.h" HAVE_STRERROR)
  147. CHECK_C_SOURCE_COMPILES(
  148. "#include <stdlib.h>
  149. #include <limits.h>
  150. int main(int c, char *v[]) { char buf[PATH_MAX]; realpath(v[c], buf); return 0; }"
  151. HAVE_REALPATH
  152. )
  153. set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
  154. set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
  155. CHECK_C_SOURCE_COMPILES(
  156. "#include <stddef.h>
  157. int main(void) { int a,b; size_t m; __builtin_mul_overflow(a,b,&m); return 0; }"
  158. HAVE_BUILTIN_MUL_OVERFLOW
  159. )
  160. CHECK_C_SOURCE_COMPILES(
  161. "int main(void) { char buf[128] __attribute__((uninitialized)); (void)buf; return 0; }"
  162. HAVE_ATTRIBUTE_UNINITIALIZED
  163. )
  164. CHECK_C_SOURCE_COMPILES([=[
  165. extern __attribute__ ((visibility ("default"))) int f(void);
  166. int main(void) { return f(); }
  167. int f(void) { return 42; }
  168. ]=] HAVE_VISIBILITY
  169. )
  170. if (HAVE_VISIBILITY)
  171. set(PCRE2_EXPORT [=[__attribute__ ((visibility ("default")))]=])
  172. else()
  173. set(PCRE2_EXPORT)
  174. endif()
  175. set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
  176. # Check whether Intel CET is enabled, and if so, adjust compiler flags. This
  177. # code was written by PH, trying to imitate the logic from the autotools
  178. # configuration.
  179. CHECK_C_SOURCE_COMPILES(
  180. "#ifndef __CET__
  181. #error CET is not enabled
  182. #endif
  183. int main() { return 0; }"
  184. INTEL_CET_ENABLED
  185. )
  186. IF (INTEL_CET_ENABLED)
  187. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mshstk")
  188. ENDIF(INTEL_CET_ENABLED)
  189. # User-configurable options
  190. #
  191. # Note: CMakeSetup displays these in alphabetical order, regardless of
  192. # the order we use here.
  193. SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries.")
  194. OPTION(BUILD_STATIC_LIBS "Build static libraries." ON)
  195. OPTION(PCRE2_BUILD_PCRE2_8 "Build 8 bit PCRE2 library" ON)
  196. OPTION(PCRE2_BUILD_PCRE2_16 "Build 16 bit PCRE2 library" OFF)
  197. OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF)
  198. OPTION(PCRE2_STATIC_PIC "Build the static library with the option position independent code enabled." OFF)
  199. OPTION(PCRE2_DEBUG "Include debugging code" OFF)
  200. OPTION(PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF)
  201. SET(PCRE2_EBCDIC OFF CACHE BOOL
  202. "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)")
  203. SET(PCRE2_EBCDIC_NL25 OFF CACHE BOOL
  204. "Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC.")
  205. SET(PCRE2_LINK_SIZE "2" CACHE STRING
  206. "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
  207. SET(PCRE2_PARENS_NEST_LIMIT "250" CACHE STRING
  208. "Default nested parentheses limit. See PARENS_NEST_LIMIT in config.h.in for details.")
  209. SET(PCRE2_HEAP_LIMIT "20000000" CACHE STRING
  210. "Default limit on heap memory (kibibytes). See HEAP_LIMIT in config.h.in for details.")
  211. SET(PCRE2_MAX_VARLOOKBEHIND "255" CACHE STRING
  212. "Default limit on variable lookbehinds.")
  213. SET(PCRE2_MATCH_LIMIT "10000000" CACHE STRING
  214. "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
  215. SET(PCRE2_MATCH_LIMIT_DEPTH "MATCH_LIMIT" CACHE STRING
  216. "Default limit on internal depth of search. See MATCH_LIMIT_DEPTH in config.h.in for details.")
  217. SET(PCRE2GREP_BUFSIZE "20480" CACHE STRING
  218. "Buffer starting size parameter for pcre2grep. See PCRE2GREP_BUFSIZE in config.h.in for details.")
  219. SET(PCRE2GREP_MAX_BUFSIZE "1048576" CACHE STRING
  220. "Buffer maximum size parameter for pcre2grep. See PCRE2GREP_MAX_BUFSIZE in config.h.in for details.")
  221. SET(PCRE2_NEWLINE "LF" CACHE STRING
  222. "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF, NUL).")
  223. SET(PCRE2_HEAP_MATCH_RECURSE OFF CACHE BOOL
  224. "Obsolete option: do not use")
  225. SET(PCRE2_SUPPORT_JIT OFF CACHE BOOL
  226. "Enable support for Just-in-time compiling.")
  227. IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  228. SET(PCRE2_SUPPORT_JIT_SEALLOC OFF CACHE BOOL
  229. "Enable SELinux compatible execmem allocator in JIT (experimental).")
  230. ELSE(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  231. SET(PCRE2_SUPPORT_JIT_SEALLOC IGNORE)
  232. ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  233. SET(PCRE2GREP_SUPPORT_JIT ON CACHE BOOL
  234. "Enable use of Just-in-time compiling in pcre2grep.")
  235. SET(PCRE2GREP_SUPPORT_CALLOUT ON CACHE BOOL
  236. "Enable callout string support in pcre2grep.")
  237. SET(PCRE2GREP_SUPPORT_CALLOUT_FORK ON CACHE BOOL
  238. "Enable callout string fork support in pcre2grep.")
  239. SET(PCRE2_SUPPORT_UNICODE ON CACHE BOOL
  240. "Enable support for Unicode and UTF-8/UTF-16/UTF-32 encoding.")
  241. SET(PCRE2_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL
  242. "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks")
  243. SET(PCRE2_NEVER_BACKSLASH_C OFF CACHE BOOL
  244. "If ON, backslash-C (upper case C) is locked out.")
  245. SET(PCRE2_SUPPORT_VALGRIND OFF CACHE BOOL
  246. "Enable Valgrind support.")
  247. OPTION(PCRE2_SHOW_REPORT "Show the final configuration report" ON)
  248. OPTION(PCRE2_BUILD_PCRE2GREP "Build pcre2grep" ON)
  249. OPTION(PCRE2_BUILD_TESTS "Build the tests" ON)
  250. IF (MINGW)
  251. OPTION(NON_STANDARD_LIB_PREFIX
  252. "ON=Shared libraries built in mingw will be named pcre2.dll, etc., instead of libpcre2.dll, etc."
  253. OFF)
  254. OPTION(NON_STANDARD_LIB_SUFFIX
  255. "ON=Shared libraries built in mingw will be named libpcre2-0.dll, etc., instead of libpcre2.dll, etc."
  256. OFF)
  257. ENDIF(MINGW)
  258. IF(MSVC)
  259. OPTION(PCRE2_STATIC_RUNTIME
  260. "ON=Compile against the static runtime (/MT)."
  261. OFF)
  262. OPTION(INSTALL_MSVC_PDB
  263. "ON=Install .pdb files built by MSVC, if generated"
  264. OFF)
  265. ENDIF(MSVC)
  266. # bzip2 lib
  267. IF(BZIP2_FOUND)
  268. OPTION (PCRE2_SUPPORT_LIBBZ2 "Enable support for linking pcre2grep with libbz2." ON)
  269. ENDIF(BZIP2_FOUND)
  270. IF(PCRE2_SUPPORT_LIBBZ2)
  271. INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
  272. ENDIF(PCRE2_SUPPORT_LIBBZ2)
  273. # zlib
  274. IF(ZLIB_FOUND)
  275. OPTION (PCRE2_SUPPORT_LIBZ "Enable support for linking pcre2grep with libz." ON)
  276. ENDIF(ZLIB_FOUND)
  277. IF(PCRE2_SUPPORT_LIBZ)
  278. INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
  279. ENDIF(PCRE2_SUPPORT_LIBZ)
  280. # editline lib
  281. IF(EDITLINE_FOUND)
  282. OPTION (PCRE2_SUPPORT_LIBEDIT "Enable support for linking pcre2test with libedit." OFF)
  283. ENDIF(EDITLINE_FOUND)
  284. IF(EDITLINE_FOUND)
  285. IF(PCRE2_SUPPORT_LIBEDIT)
  286. INCLUDE_DIRECTORIES(${EDITLINE_INCLUDE_DIR})
  287. ENDIF(PCRE2_SUPPORT_LIBEDIT)
  288. ELSE(EDITLINE_FOUND)
  289. IF(PCRE2_SUPPORT_LIBEDIT)
  290. MESSAGE(FATAL_ERROR
  291. " libedit not found, set EDITLINE_INCLUDE_DIR to a compatible header\n"
  292. " or set Editline_ROOT to a full libedit installed tree, as needed\n"
  293. " Might need to enable policy CMP0074 in CMakeLists.txt"
  294. )
  295. ENDIF(PCRE2_SUPPORT_LIBEDIT)
  296. ENDIF(EDITLINE_FOUND)
  297. # readline lib
  298. IF(READLINE_FOUND)
  299. OPTION (PCRE2_SUPPORT_LIBREADLINE "Enable support for linking pcre2test with libreadline." ON)
  300. ENDIF(READLINE_FOUND)
  301. IF(PCRE2_SUPPORT_LIBREADLINE)
  302. INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
  303. ENDIF(PCRE2_SUPPORT_LIBREADLINE)
  304. # Prepare build configuration
  305. IF(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
  306. MESSAGE(FATAL_ERROR "At least one of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be enabled.")
  307. ENDIF(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
  308. IF(NOT PCRE2_BUILD_PCRE2_8 AND NOT PCRE2_BUILD_PCRE2_16 AND NOT PCRE2_BUILD_PCRE2_32)
  309. MESSAGE(FATAL_ERROR "At least one of PCRE2_BUILD_PCRE2_8, PCRE2_BUILD_PCRE2_16 or PCRE2_BUILD_PCRE2_32 must be enabled")
  310. ENDIF(NOT PCRE2_BUILD_PCRE2_8 AND NOT PCRE2_BUILD_PCRE2_16 AND NOT PCRE2_BUILD_PCRE2_32)
  311. IF(PCRE2_BUILD_PCRE2_8)
  312. SET(SUPPORT_PCRE2_8 1)
  313. ENDIF(PCRE2_BUILD_PCRE2_8)
  314. IF(PCRE2_BUILD_PCRE2_16)
  315. SET(SUPPORT_PCRE2_16 1)
  316. ENDIF(PCRE2_BUILD_PCRE2_16)
  317. IF(PCRE2_BUILD_PCRE2_32)
  318. SET(SUPPORT_PCRE2_32 1)
  319. ENDIF(PCRE2_BUILD_PCRE2_32)
  320. IF(PCRE2_BUILD_PCRE2GREP AND NOT PCRE2_BUILD_PCRE2_8)
  321. MESSAGE(STATUS "** PCRE2_BUILD_PCRE2_8 must be enabled for the pcre2grep program")
  322. SET(PCRE2_BUILD_PCRE2GREP OFF)
  323. ENDIF(PCRE2_BUILD_PCRE2GREP AND NOT PCRE2_BUILD_PCRE2_8)
  324. IF(PCRE2_SUPPORT_LIBREADLINE AND PCRE2_SUPPORT_LIBEDIT)
  325. IF(READLINE_FOUND)
  326. MESSAGE(FATAL_ERROR
  327. " Only one of the readline compatible libraries can be enabled.\n"
  328. " Disable libreadline with -DPCRE2_SUPPORT_LIBREADLINE=OFF"
  329. )
  330. ENDIF(READLINE_FOUND)
  331. ENDIF(PCRE2_SUPPORT_LIBREADLINE AND PCRE2_SUPPORT_LIBEDIT)
  332. IF(PCRE2_SUPPORT_BSR_ANYCRLF)
  333. SET(BSR_ANYCRLF 1)
  334. ENDIF(PCRE2_SUPPORT_BSR_ANYCRLF)
  335. IF(PCRE2_NEVER_BACKSLASH_C)
  336. SET(NEVER_BACKSLASH_C 1)
  337. ENDIF(PCRE2_NEVER_BACKSLASH_C)
  338. IF(PCRE2_SUPPORT_UNICODE)
  339. SET(SUPPORT_UNICODE 1)
  340. ENDIF(PCRE2_SUPPORT_UNICODE)
  341. IF(PCRE2_SUPPORT_JIT)
  342. SET(SUPPORT_JIT 1)
  343. IF(UNIX)
  344. FIND_PACKAGE(Threads REQUIRED)
  345. IF(CMAKE_USE_PTHREADS_INIT)
  346. SET(REQUIRE_PTHREAD 1)
  347. ENDIF(CMAKE_USE_PTHREADS_INIT)
  348. ENDIF(UNIX)
  349. ENDIF(PCRE2_SUPPORT_JIT)
  350. IF(PCRE2_SUPPORT_JIT_SEALLOC)
  351. SET(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
  352. CHECK_SYMBOL_EXISTS(mkostemp stdlib.h REQUIRED)
  353. UNSET(CMAKE_REQUIRED_DEFINITIONS)
  354. IF(${REQUIRED})
  355. IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  356. ADD_DEFINITIONS(-D_GNU_SOURCE)
  357. SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1)
  358. ELSE(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  359. MESSAGE(FATAL_ERROR "Your configuration is not supported")
  360. ENDIF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  361. ELSE(${REQUIRED})
  362. SET(PCRE2_SUPPORT_JIT_SEALLOC OFF)
  363. ENDIF(${REQUIRED})
  364. ENDIF(PCRE2_SUPPORT_JIT_SEALLOC)
  365. IF(PCRE2GREP_SUPPORT_JIT)
  366. SET(SUPPORT_PCRE2GREP_JIT 1)
  367. ENDIF(PCRE2GREP_SUPPORT_JIT)
  368. IF(PCRE2GREP_SUPPORT_CALLOUT)
  369. SET(SUPPORT_PCRE2GREP_CALLOUT 1)
  370. IF(PCRE2GREP_SUPPORT_CALLOUT_FORK)
  371. SET(SUPPORT_PCRE2GREP_CALLOUT_FORK 1)
  372. ENDIF(PCRE2GREP_SUPPORT_CALLOUT_FORK)
  373. ENDIF(PCRE2GREP_SUPPORT_CALLOUT)
  374. IF(PCRE2_SUPPORT_VALGRIND)
  375. SET(SUPPORT_VALGRIND 1)
  376. ENDIF(PCRE2_SUPPORT_VALGRIND)
  377. IF(PCRE2_DISABLE_PERCENT_ZT)
  378. SET(DISABLE_PERCENT_ZT 1)
  379. ENDIF(PCRE2_DISABLE_PERCENT_ZT)
  380. # This next one used to reference ${READLINE_LIBRARY})
  381. # but I was advised to add the NCURSES test as well, along with
  382. # some modifications to cmake/FindReadline.cmake which should
  383. # make it possible to override the default if necessary. PH
  384. IF(PCRE2_SUPPORT_LIBREADLINE)
  385. SET(SUPPORT_LIBREADLINE 1)
  386. SET(PCRE2TEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY})
  387. ENDIF(PCRE2_SUPPORT_LIBREADLINE)
  388. # libedit is a plug-compatible alternative to libreadline
  389. IF(PCRE2_SUPPORT_LIBEDIT)
  390. SET(SUPPORT_LIBEDIT 1)
  391. SET(PCRE2TEST_LIBS ${EDITLINE_LIBRARY} ${NCURSES_LIBRARY})
  392. ENDIF(PCRE2_SUPPORT_LIBEDIT)
  393. IF(PCRE2_SUPPORT_LIBZ)
  394. SET(SUPPORT_LIBZ 1)
  395. SET(PCRE2GREP_LIBS ${PCRE2GREP_LIBS} ${ZLIB_LIBRARIES})
  396. ENDIF(PCRE2_SUPPORT_LIBZ)
  397. IF(PCRE2_SUPPORT_LIBBZ2)
  398. SET(SUPPORT_LIBBZ2 1)
  399. SET(PCRE2GREP_LIBS ${PCRE2GREP_LIBS} ${BZIP2_LIBRARIES})
  400. ENDIF(PCRE2_SUPPORT_LIBBZ2)
  401. SET(NEWLINE_DEFAULT "")
  402. IF(PCRE2_NEWLINE STREQUAL "CR")
  403. SET(NEWLINE_DEFAULT "1")
  404. ENDIF(PCRE2_NEWLINE STREQUAL "CR")
  405. IF(PCRE2_NEWLINE STREQUAL "LF")
  406. SET(NEWLINE_DEFAULT "2")
  407. ENDIF(PCRE2_NEWLINE STREQUAL "LF")
  408. IF(PCRE2_NEWLINE STREQUAL "CRLF")
  409. SET(NEWLINE_DEFAULT "3")
  410. ENDIF(PCRE2_NEWLINE STREQUAL "CRLF")
  411. IF(PCRE2_NEWLINE STREQUAL "ANY")
  412. SET(NEWLINE_DEFAULT "4")
  413. ENDIF(PCRE2_NEWLINE STREQUAL "ANY")
  414. IF(PCRE2_NEWLINE STREQUAL "ANYCRLF")
  415. SET(NEWLINE_DEFAULT "5")
  416. ENDIF(PCRE2_NEWLINE STREQUAL "ANYCRLF")
  417. IF(PCRE2_NEWLINE STREQUAL "NUL")
  418. SET(NEWLINE_DEFAULT "6")
  419. ENDIF(PCRE2_NEWLINE STREQUAL "NUL")
  420. IF(NEWLINE_DEFAULT STREQUAL "")
  421. MESSAGE(FATAL_ERROR "The PCRE2_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
  422. ENDIF(NEWLINE_DEFAULT STREQUAL "")
  423. IF(PCRE2_EBCDIC)
  424. SET(EBCDIC 1)
  425. ENDIF(PCRE2_EBCDIC)
  426. IF(PCRE2_EBCDIC_NL25)
  427. SET(EBCDIC 1)
  428. SET(EBCDIC_NL25 1)
  429. ENDIF(PCRE2_EBCDIC_NL25)
  430. # Output files
  431. CONFIGURE_FILE(config-cmake.h.in
  432. ${PROJECT_BINARY_DIR}/config.h
  433. @ONLY)
  434. # Parse version numbers and date out of configure.ac
  435. file(STRINGS ${PROJECT_SOURCE_DIR}/configure.ac
  436. configure_lines
  437. LIMIT_COUNT 50 # Read only the first 50 lines of the file
  438. )
  439. set(SEARCHED_VARIABLES "pcre2_major" "pcre2_minor" "pcre2_prerelease" "pcre2_date"
  440. "libpcre2_posix_version" "libpcre2_8_version" "libpcre2_16_version" "libpcre2_32_version")
  441. foreach(configure_line ${configure_lines})
  442. foreach(_substitution_variable ${SEARCHED_VARIABLES})
  443. string(TOUPPER ${_substitution_variable} _substitution_variable_upper)
  444. if (NOT ${_substitution_variable_upper})
  445. string(REGEX MATCH "m4_define\\(${_substitution_variable}, *\\[(.*)\\]" MATCHED_STRING ${configure_line})
  446. if (CMAKE_MATCH_1)
  447. set(${_substitution_variable_upper} ${CMAKE_MATCH_1})
  448. endif()
  449. endif()
  450. endforeach()
  451. endforeach()
  452. macro(PARSE_LIB_VERSION VARIABLE_PREFIX)
  453. string(REPLACE ":" ";" ${VARIABLE_PREFIX}_VERSION_LIST ${${VARIABLE_PREFIX}_VERSION})
  454. list(GET ${VARIABLE_PREFIX}_VERSION_LIST 0 ${VARIABLE_PREFIX}_VERSION_CURRENT)
  455. list(GET ${VARIABLE_PREFIX}_VERSION_LIST 1 ${VARIABLE_PREFIX}_VERSION_REVISION)
  456. list(GET ${VARIABLE_PREFIX}_VERSION_LIST 2 ${VARIABLE_PREFIX}_VERSION_AGE)
  457. math(EXPR ${VARIABLE_PREFIX}_SOVERSION "${${VARIABLE_PREFIX}_VERSION_CURRENT} - ${${VARIABLE_PREFIX}_VERSION_AGE}")
  458. math(EXPR ${VARIABLE_PREFIX}_MACHO_COMPATIBILITY_VERSION "${${VARIABLE_PREFIX}_VERSION_CURRENT} + 1")
  459. math(EXPR ${VARIABLE_PREFIX}_MACHO_CURRENT_VERSION "${${VARIABLE_PREFIX}_VERSION_CURRENT} + 1")
  460. set(${VARIABLE_PREFIX}_MACHO_CURRENT_VERSION "${${VARIABLE_PREFIX}_MACHO_CURRENT_VERSION}.${${VARIABLE_PREFIX}_VERSION_REVISION}}")
  461. set(${VARIABLE_PREFIX}_VERSION "${${VARIABLE_PREFIX}_SOVERSION}.${${VARIABLE_PREFIX}_VERSION_AGE}.${${VARIABLE_PREFIX}_VERSION_REVISION}")
  462. endmacro()
  463. PARSE_LIB_VERSION(LIBPCRE2_POSIX)
  464. PARSE_LIB_VERSION(LIBPCRE2_8)
  465. PARSE_LIB_VERSION(LIBPCRE2_16)
  466. PARSE_LIB_VERSION(LIBPCRE2_32)
  467. CONFIGURE_FILE(src/pcre2.h.in
  468. ${PROJECT_BINARY_DIR}/pcre2.h
  469. @ONLY)
  470. # Make sure to not link debug libs
  471. # against release libs and vice versa
  472. IF(WIN32)
  473. SET(CMAKE_DEBUG_POSTFIX "d")
  474. ENDIF(WIN32)
  475. # Character table generation
  476. OPTION(PCRE2_REBUILD_CHARTABLES "Rebuild char tables" OFF)
  477. IF(PCRE2_REBUILD_CHARTABLES)
  478. ADD_EXECUTABLE(pcre2_dftables src/pcre2_dftables.c)
  479. ADD_CUSTOM_COMMAND(
  480. COMMENT "Generating character tables (pcre2_chartables.c) for current locale"
  481. DEPENDS pcre2_dftables
  482. COMMAND pcre2_dftables
  483. ARGS ${PROJECT_BINARY_DIR}/pcre2_chartables.c
  484. OUTPUT ${PROJECT_BINARY_DIR}/pcre2_chartables.c
  485. )
  486. ELSE(PCRE2_REBUILD_CHARTABLES)
  487. CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/pcre2_chartables.c.dist
  488. ${PROJECT_BINARY_DIR}/pcre2_chartables.c
  489. COPYONLY)
  490. ENDIF(PCRE2_REBUILD_CHARTABLES)
  491. # Source code
  492. SET(PCRE2_HEADERS ${PROJECT_BINARY_DIR}/pcre2.h)
  493. SET(PCRE2_SOURCES
  494. src/pcre2_auto_possess.c
  495. ${PROJECT_BINARY_DIR}/pcre2_chartables.c
  496. src/pcre2_chkdint.c
  497. src/pcre2_compile.c
  498. src/pcre2_config.c
  499. src/pcre2_context.c
  500. src/pcre2_convert.c
  501. src/pcre2_dfa_match.c
  502. src/pcre2_error.c
  503. src/pcre2_extuni.c
  504. src/pcre2_find_bracket.c
  505. src/pcre2_jit_compile.c
  506. src/pcre2_maketables.c
  507. src/pcre2_match.c
  508. src/pcre2_match_data.c
  509. src/pcre2_newline.c
  510. src/pcre2_ord2utf.c
  511. src/pcre2_pattern_info.c
  512. src/pcre2_script_run.c
  513. src/pcre2_serialize.c
  514. src/pcre2_string_utils.c
  515. src/pcre2_study.c
  516. src/pcre2_substitute.c
  517. src/pcre2_substring.c
  518. src/pcre2_tables.c
  519. src/pcre2_ucd.c
  520. src/pcre2_valid_utf.c
  521. src/pcre2_xclass.c
  522. )
  523. SET(PCRE2POSIX_HEADERS src/pcre2posix.h)
  524. SET(PCRE2POSIX_SOURCES src/pcre2posix.c)
  525. IF(MINGW AND BUILD_SHARED_LIBS)
  526. IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
  527. ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2.o
  528. PRE-LINK
  529. COMMAND windres ARGS pcre2.rc pcre2.o
  530. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  531. COMMENT Using pcre2 coff info in mingw build)
  532. SET(PCRE2_SOURCES ${PCRE2_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2.o)
  533. ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
  534. IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
  535. ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2posix.o
  536. PRE-LINK
  537. COMMAND windres ARGS pcre2posix.rc pcre2posix.o
  538. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  539. COMMENT Using pcre2posix coff info in mingw build)
  540. SET(PCRE2POSIX_SOURCES ${PCRE2POSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2posix.o)
  541. ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
  542. ENDIF(MINGW AND BUILD_SHARED_LIBS)
  543. IF(MSVC AND BUILD_SHARED_LIBS)
  544. SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-posix.pdb ${dll_pdb_files})
  545. SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-posixd.pdb ${dll_pdb_debug_files})
  546. IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
  547. SET(PCRE2_SOURCES ${PCRE2_SOURCES} pcre2.rc)
  548. ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
  549. IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
  550. SET(PCRE2POSIX_SOURCES ${PCRE2POSIX_SOURCES} pcre2posix.rc)
  551. ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
  552. ENDIF(MSVC AND BUILD_SHARED_LIBS)
  553. # Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
  554. # This code was taken from the CMake wiki, not from WebM.
  555. IF(MSVC AND PCRE2_STATIC_RUNTIME)
  556. MESSAGE(STATUS "** MSVC and PCRE2_STATIC_RUNTIME: modifying compiler flags to use static runtime library")
  557. foreach(flag_var
  558. CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
  559. CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
  560. string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
  561. endforeach()
  562. ENDIF(MSVC AND PCRE2_STATIC_RUNTIME)
  563. # Build setup
  564. ADD_DEFINITIONS(-DHAVE_CONFIG_H)
  565. IF(MSVC)
  566. ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
  567. ENDIF(MSVC)
  568. SET(CMAKE_INCLUDE_CURRENT_DIR 1)
  569. set(targets)
  570. # 8-bit library
  571. IF(PCRE2_BUILD_PCRE2_8)
  572. IF(BUILD_STATIC_LIBS)
  573. ADD_LIBRARY(pcre2-8-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  574. SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES
  575. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
  576. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
  577. MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
  578. VERSION ${LIBPCRE2_8_VERSION}
  579. SOVERSION ${LIBPCRE2_8_SOVERSION})
  580. TARGET_COMPILE_DEFINITIONS(pcre2-8-static PUBLIC PCRE2_STATIC)
  581. TARGET_INCLUDE_DIRECTORIES(pcre2-8-static PUBLIC ${PROJECT_BINARY_DIR})
  582. IF(REQUIRE_PTHREAD)
  583. TARGET_LINK_LIBRARIES(pcre2-8-static Threads::Threads)
  584. ENDIF(REQUIRE_PTHREAD)
  585. SET(targets ${targets} pcre2-8-static)
  586. ADD_LIBRARY(pcre2-posix-static STATIC ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
  587. SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES
  588. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
  589. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
  590. MACHO_CURRENT_VERSION "${LIBPCRE2_POSIX_MACHO_CURRENT_VERSION}"
  591. VERSION ${LIBPCRE2_POSIX_VERSION}
  592. SOVERSION ${LIBPCRE2_POSIX_SOVERSION})
  593. TARGET_LINK_LIBRARIES(pcre2-posix-static pcre2-8-static)
  594. TARGET_INCLUDE_DIRECTORIES(pcre2-posix-static PUBLIC ${PROJECT_SOURCE_DIR}/src)
  595. set(targets ${targets} pcre2-posix-static)
  596. IF(MSVC)
  597. SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES OUTPUT_NAME pcre2-8-static)
  598. SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES OUTPUT_NAME pcre2-posix-static)
  599. ELSE(MSVC)
  600. SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES OUTPUT_NAME pcre2-8)
  601. SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES OUTPUT_NAME pcre2-posix)
  602. ENDIF(MSVC)
  603. IF(PCRE2_STATIC_PIC)
  604. SET_TARGET_PROPERTIES(pcre2-8-static pcre2-posix-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
  605. ENDIF(PCRE2_STATIC_PIC)
  606. ENDIF(BUILD_STATIC_LIBS)
  607. IF(BUILD_SHARED_LIBS)
  608. ADD_LIBRARY(pcre2-8-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  609. TARGET_INCLUDE_DIRECTORIES(pcre2-8-shared PUBLIC ${PROJECT_BINARY_DIR})
  610. SET_TARGET_PROPERTIES(pcre2-8-shared PROPERTIES
  611. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
  612. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
  613. MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
  614. VERSION ${LIBPCRE2_8_VERSION}
  615. SOVERSION ${LIBPCRE2_8_SOVERSION}
  616. OUTPUT_NAME pcre2-8)
  617. IF(REQUIRE_PTHREAD)
  618. TARGET_LINK_LIBRARIES(pcre2-8-shared Threads::Threads)
  619. ENDIF(REQUIRE_PTHREAD)
  620. set(targets ${targets} pcre2-8-shared)
  621. ADD_LIBRARY(pcre2-posix-shared SHARED ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
  622. TARGET_INCLUDE_DIRECTORIES(pcre2-posix-shared PUBLIC ${PROJECT_SOURCE_DIR}/src)
  623. SET_TARGET_PROPERTIES(pcre2-posix-shared PROPERTIES
  624. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
  625. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
  626. MACHO_CURRENT_VERSION "${LIBPCRE2_POSIX_MACHO_CURRENT_VERSION}"
  627. VERSION ${LIBPCRE2_POSIX_VERSION}
  628. SOVERSION ${LIBPCRE2_POSIX_SOVERSION}
  629. OUTPUT_NAME pcre2-posix)
  630. set(PCRE2POSIX_CFLAG "-DPCRE2POSIX_SHARED")
  631. TARGET_COMPILE_DEFINITIONS(pcre2-posix-shared PUBLIC ${PCRE2POSIX_CFLAG})
  632. TARGET_LINK_LIBRARIES(pcre2-posix-shared pcre2-8-shared)
  633. SET(targets ${targets} pcre2-posix-shared)
  634. SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-8.pdb ${dll_pdb_files})
  635. SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-8d.pdb ${dll_pdb_debug_files})
  636. IF(MINGW)
  637. IF(NON_STANDARD_LIB_PREFIX)
  638. SET_TARGET_PROPERTIES(pcre2-8-shared pcre2-posix-shared PROPERTIES PREFIX "")
  639. ENDIF(NON_STANDARD_LIB_PREFIX)
  640. IF(NON_STANDARD_LIB_SUFFIX)
  641. SET_TARGET_PROPERTIES(pcre2-8-shared pcre2-posix-shared PROPERTIES SUFFIX "-0.dll")
  642. ENDIF(NON_STANDARD_LIB_SUFFIX)
  643. ENDIF(MINGW)
  644. ENDIF(BUILD_SHARED_LIBS)
  645. IF(BUILD_STATIC_LIBS)
  646. ADD_LIBRARY(pcre2-8 ALIAS pcre2-8-static)
  647. ADD_LIBRARY(pcre2-posix ALIAS pcre2-posix-static)
  648. ELSE(BUILD_STATIC_LIBS)
  649. ADD_LIBRARY(pcre2-8 ALIAS pcre2-8-shared)
  650. ADD_LIBRARY(pcre2-posix ALIAS pcre2-posix-shared)
  651. ENDIF(BUILD_STATIC_LIBS)
  652. ENDIF(PCRE2_BUILD_PCRE2_8)
  653. # 16-bit library
  654. IF(PCRE2_BUILD_PCRE2_16)
  655. IF(BUILD_STATIC_LIBS)
  656. ADD_LIBRARY(pcre2-16-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  657. TARGET_INCLUDE_DIRECTORIES(pcre2-16-static PUBLIC ${PROJECT_BINARY_DIR})
  658. SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES UNITY_BUILD OFF
  659. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
  660. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
  661. MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
  662. VERSION ${LIBPCRE2_16_VERSION}
  663. SOVERSION ${LIBPCRE2_16_SOVERSION})
  664. TARGET_COMPILE_DEFINITIONS(pcre2-16-static PUBLIC PCRE2_STATIC)
  665. IF(REQUIRE_PTHREAD)
  666. TARGET_LINK_LIBRARIES(pcre2-16-static Threads::Threads)
  667. ENDIF(REQUIRE_PTHREAD)
  668. set(targets ${targets} pcre2-16-static)
  669. IF(MSVC)
  670. SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16-static)
  671. ELSE(MSVC)
  672. SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16)
  673. ENDIF(MSVC)
  674. IF(PCRE2_STATIC_PIC)
  675. SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
  676. ENDIF(PCRE2_STATIC_PIC)
  677. ENDIF(BUILD_STATIC_LIBS)
  678. IF(BUILD_SHARED_LIBS)
  679. ADD_LIBRARY(pcre2-16-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  680. TARGET_INCLUDE_DIRECTORIES(pcre2-16-shared PUBLIC ${PROJECT_BINARY_DIR})
  681. SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES UNITY_BUILD OFF
  682. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
  683. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
  684. MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
  685. VERSION ${LIBPCRE2_16_VERSION}
  686. SOVERSION ${LIBPCRE2_16_SOVERSION}
  687. OUTPUT_NAME pcre2-16)
  688. IF(REQUIRE_PTHREAD)
  689. TARGET_LINK_LIBRARIES(pcre2-16-shared Threads::Threads)
  690. ENDIF(REQUIRE_PTHREAD)
  691. set(targets ${targets} pcre2-16-shared)
  692. SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-16.pdb ${dll_pdb_files})
  693. SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-16d.pdb ${dll_pdb_debug_files})
  694. IF(MINGW)
  695. IF(NON_STANDARD_LIB_PREFIX)
  696. SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES PREFIX "")
  697. ENDIF(NON_STANDARD_LIB_PREFIX)
  698. IF(NON_STANDARD_LIB_SUFFIX)
  699. SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES SUFFIX "-0.dll")
  700. ENDIF(NON_STANDARD_LIB_SUFFIX)
  701. ENDIF(MINGW)
  702. ENDIF(BUILD_SHARED_LIBS)
  703. IF(BUILD_STATIC_LIBS)
  704. ADD_LIBRARY(pcre2-16 ALIAS pcre2-16-static)
  705. ELSE(BUILD_STATIC_LIBS)
  706. ADD_LIBRARY(pcre2-16 ALIAS pcre2-16-shared)
  707. ENDIF(BUILD_STATIC_LIBS)
  708. ENDIF(PCRE2_BUILD_PCRE2_16)
  709. # 32-bit library
  710. IF(PCRE2_BUILD_PCRE2_32)
  711. IF(BUILD_STATIC_LIBS)
  712. ADD_LIBRARY(pcre2-32-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  713. TARGET_INCLUDE_DIRECTORIES(pcre2-32-static PUBLIC ${PROJECT_BINARY_DIR})
  714. SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES UNITY_BUILD OFF
  715. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
  716. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
  717. MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
  718. VERSION ${LIBPCRE2_32_VERSION}
  719. SOVERSION ${LIBPCRE2_32_SOVERSION})
  720. TARGET_COMPILE_DEFINITIONS(pcre2-32-static PUBLIC PCRE2_STATIC)
  721. IF(REQUIRE_PTHREAD)
  722. TARGET_LINK_LIBRARIES(pcre2-32-static Threads::Threads)
  723. ENDIF(REQUIRE_PTHREAD)
  724. set(targets ${targets} pcre2-32-static)
  725. IF(MSVC)
  726. SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32-static)
  727. ELSE(MSVC)
  728. SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32)
  729. ENDIF(MSVC)
  730. IF(PCRE2_STATIC_PIC)
  731. SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
  732. ENDIF(PCRE2_STATIC_PIC)
  733. ENDIF(BUILD_STATIC_LIBS)
  734. IF(BUILD_SHARED_LIBS)
  735. ADD_LIBRARY(pcre2-32-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
  736. TARGET_INCLUDE_DIRECTORIES(pcre2-32-shared PUBLIC ${PROJECT_BINARY_DIR})
  737. SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES UNITY_BUILD OFF
  738. COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
  739. MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
  740. MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
  741. VERSION ${LIBPCRE2_32_VERSION}
  742. SOVERSION ${LIBPCRE2_32_SOVERSION}
  743. OUTPUT_NAME pcre2-32)
  744. IF(REQUIRE_PTHREAD)
  745. TARGET_LINK_LIBRARIES(pcre2-32-shared Threads::Threads)
  746. ENDIF(REQUIRE_PTHREAD)
  747. set(targets ${targets} pcre2-32-shared)
  748. SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-32.pdb ${dll_pdb_files})
  749. SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-32d.pdb ${dll_pdb_debug_files})
  750. IF(MINGW)
  751. IF(NON_STANDARD_LIB_PREFIX)
  752. SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES PREFIX "")
  753. ENDIF(NON_STANDARD_LIB_PREFIX)
  754. IF(NON_STANDARD_LIB_SUFFIX)
  755. SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES SUFFIX "-0.dll")
  756. ENDIF(NON_STANDARD_LIB_SUFFIX)
  757. ENDIF(MINGW)
  758. ENDIF(BUILD_SHARED_LIBS)
  759. IF(BUILD_STATIC_LIBS)
  760. ADD_LIBRARY(pcre2-32 ALIAS pcre2-32-static)
  761. ELSE(BUILD_STATIC_LIBS)
  762. ADD_LIBRARY(pcre2-32 ALIAS pcre2-32-shared)
  763. ENDIF(BUILD_STATIC_LIBS)
  764. ENDIF(PCRE2_BUILD_PCRE2_32)
  765. # Generate pkg-config files
  766. set(PACKAGE_VERSION "${PCRE2_MAJOR}.${PCRE2_MINOR}")
  767. set(prefix ${CMAKE_INSTALL_PREFIX})
  768. set(exec_prefix "\${prefix}")
  769. set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
  770. set(includedir "\${prefix}/include")
  771. if(WIN32 AND (CMAKE_BUILD_TYPE MATCHES Debug))
  772. set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
  773. endif()
  774. if(PCRE2_BUILD_PCRE2_8)
  775. configure_file(libpcre2-posix.pc.in libpcre2-posix.pc @ONLY)
  776. list(APPEND pkg_config_files "${CMAKE_CURRENT_BINARY_DIR}/libpcre2-posix.pc")
  777. configure_file(libpcre2-8.pc.in libpcre2-8.pc @ONLY)
  778. list(APPEND pkg_config_files "${CMAKE_CURRENT_BINARY_DIR}/libpcre2-8.pc")
  779. set(enable_pcre2_8 "yes")
  780. else()
  781. set(enable_pcre2_8 "no")
  782. endif()
  783. if(PCRE2_BUILD_PCRE2_16)
  784. configure_file(libpcre2-16.pc.in libpcre2-16.pc @ONLY)
  785. list(APPEND pkg_config_files "${CMAKE_CURRENT_BINARY_DIR}/libpcre2-16.pc")
  786. set(enable_pcre2_16 "yes")
  787. else()
  788. set(enable_pcre2_16 "no")
  789. endif()
  790. if(PCRE2_BUILD_PCRE2_32)
  791. configure_file(libpcre2-32.pc.in libpcre2-32.pc @ONLY)
  792. list(APPEND pkg_config_files "${CMAKE_CURRENT_BINARY_DIR}/libpcre2-32.pc")
  793. set(enable_pcre2_32 "yes")
  794. else()
  795. set(enable_pcre2_32 "no")
  796. endif()
  797. configure_file(pcre2-config.in pcre2-config @ONLY NEWLINE_STYLE LF)
  798. # Executables
  799. IF(PCRE2_BUILD_PCRE2GREP)
  800. ADD_EXECUTABLE(pcre2grep src/pcre2grep.c)
  801. SET_PROPERTY(TARGET pcre2grep
  802. PROPERTY COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8)
  803. set(targets ${targets} pcre2grep)
  804. TARGET_LINK_LIBRARIES(pcre2grep pcre2-posix ${PCRE2GREP_LIBS})
  805. ENDIF(PCRE2_BUILD_PCRE2GREP)
  806. # Testing
  807. IF(PCRE2_BUILD_TESTS)
  808. ENABLE_TESTING()
  809. SET(PCRE2TEST_SOURCES src/pcre2test.c)
  810. IF(MSVC)
  811. # This is needed to avoid a stack overflow error in the standard tests. The
  812. # flag should be indicated with a forward-slash instead of a hyphen, but
  813. # then CMake treats it as a file path.
  814. SET(PCRE2TEST_LINKER_FLAGS -STACK:2500000)
  815. ENDIF(MSVC)
  816. ADD_EXECUTABLE(pcre2test ${PCRE2TEST_SOURCES})
  817. set(targets ${targets} pcre2test)
  818. IF(PCRE2_BUILD_PCRE2_8)
  819. LIST(APPEND PCRE2TEST_LIBS pcre2-posix pcre2-8)
  820. ENDIF(PCRE2_BUILD_PCRE2_8)
  821. IF(PCRE2_BUILD_PCRE2_16)
  822. LIST(APPEND PCRE2TEST_LIBS pcre2-16)
  823. ENDIF(PCRE2_BUILD_PCRE2_16)
  824. IF(PCRE2_BUILD_PCRE2_32)
  825. LIST(APPEND PCRE2TEST_LIBS pcre2-32)
  826. ENDIF(PCRE2_BUILD_PCRE2_32)
  827. TARGET_LINK_LIBRARIES(pcre2test ${PCRE2TEST_LIBS} ${PCRE2TEST_LINKER_FLAGS})
  828. IF(PCRE2_BUILD_PCRE2_8)
  829. ADD_EXECUTABLE(pcre2posix_test src/pcre2posix_test.c)
  830. TARGET_LINK_LIBRARIES(pcre2posix_test pcre2-posix pcre2-8)
  831. ENDIF(PCRE2_BUILD_PCRE2_8)
  832. IF(PCRE2_SUPPORT_JIT)
  833. ADD_EXECUTABLE(pcre2_jit_test src/pcre2_jit_test.c)
  834. SET(PCRE2_JIT_TEST_LIBS)
  835. IF(PCRE2_BUILD_PCRE2_8)
  836. LIST(APPEND PCRE2_JIT_TEST_LIBS pcre2-8)
  837. ENDIF(PCRE2_BUILD_PCRE2_8)
  838. IF(PCRE2_BUILD_PCRE2_16)
  839. LIST(APPEND PCRE2_JIT_TEST_LIBS pcre2-16)
  840. ENDIF(PCRE2_BUILD_PCRE2_16)
  841. IF(PCRE2_BUILD_PCRE2_32)
  842. LIST(APPEND PCRE2_JIT_TEST_LIBS pcre2-32)
  843. ENDIF(PCRE2_BUILD_PCRE2_32)
  844. TARGET_LINK_LIBRARIES(pcre2_jit_test ${PCRE2_JIT_TEST_LIBS})
  845. ENDIF(PCRE2_SUPPORT_JIT)
  846. # exes in Debug location tested by the RunTest and RunGrepTest shell scripts
  847. # via "make test"
  848. # The commented out code below provokes a warning about future removal
  849. # of the facility, and requires policy CMP0026 to be set to "OLD". I have
  850. # got fed-up with the warnings, but my plea for help on the mailing list
  851. # produced no response. So, I've hacked. The new code below seems to work on
  852. # Linux.
  853. # IF(PCRE2_BUILD_PCRE2GREP)
  854. # GET_TARGET_PROPERTY(PCRE2GREP_EXE pcre2grep DEBUG_LOCATION)
  855. # ENDIF(PCRE2_BUILD_PCRE2GREP)
  856. #
  857. # GET_TARGET_PROPERTY(PCRE2TEST_EXE pcre2test DEBUG_LOCATION)
  858. IF(PCRE2_BUILD_PCRE2GREP)
  859. SET(PCRE2GREP_EXE $<TARGET_FILE:pcre2grep>)
  860. ENDIF(PCRE2_BUILD_PCRE2GREP)
  861. SET(PCRE2TEST_EXE $<TARGET_FILE:pcre2test>)
  862. # =================================================
  863. # Write out a CTest configuration file
  864. #
  865. FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest
  866. "# This is a generated file.
  867. MESSAGE(\"When testing is complete, review test output in the
  868. \\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
  869. MESSAGE(\" \")
  870. ")
  871. FILE(WRITE ${PROJECT_BINARY_DIR}/pcre2_test.sh
  872. "#! /bin/sh
  873. # This is a generated file.
  874. srcdir=${PROJECT_SOURCE_DIR}
  875. . ${PROJECT_SOURCE_DIR}/RunTest
  876. if test \"$?\" != \"0\"; then exit 1; fi
  877. # End
  878. ")
  879. IF(UNIX)
  880. ADD_TEST(pcre2_test sh ${PROJECT_BINARY_DIR}/pcre2_test.sh)
  881. ENDIF(UNIX)
  882. IF(PCRE2_BUILD_PCRE2GREP)
  883. FILE(WRITE ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh
  884. "#! /bin/sh
  885. # This is a generated file.
  886. srcdir=${PROJECT_SOURCE_DIR}
  887. . ${PROJECT_SOURCE_DIR}/RunGrepTest
  888. if test \"$?\" != \"0\"; then exit 1; fi
  889. # End
  890. ")
  891. IF(UNIX)
  892. ADD_TEST(pcre2_grep_test sh ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh)
  893. ENDIF(UNIX)
  894. ENDIF(PCRE2_BUILD_PCRE2GREP)
  895. IF(WIN32)
  896. # Provide environment for executing the bat file version of RunTest
  897. FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
  898. FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)
  899. FILE(TO_NATIVE_PATH ${PCRE2TEST_EXE} winexe)
  900. FILE(WRITE ${PROJECT_BINARY_DIR}/pcre2_test.bat
  901. "\@REM This is a generated file.
  902. \@echo off
  903. setlocal
  904. SET srcdir=\"${winsrc}\"
  905. # The next line was replaced by the following one after a user comment.
  906. # SET pcre2test=\"${winexe}\"
  907. SET pcre2test=\"${winbin}\\pcre2test.exe\"
  908. if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2test=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcre2test.exe\"
  909. call %srcdir%\\RunTest.Bat
  910. if errorlevel 1 exit /b 1
  911. echo RunTest.bat tests successfully completed
  912. ")
  913. ADD_TEST(NAME pcre2_test_bat
  914. COMMAND pcre2_test.bat)
  915. SET_TESTS_PROPERTIES(pcre2_test_bat PROPERTIES
  916. PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")
  917. IF("$ENV{OSTYPE}" STREQUAL "msys")
  918. # Both the sh and bat file versions of RunTest are run if make test is used
  919. # in msys
  920. ADD_TEST(pcre2_test_sh sh.exe ${PROJECT_BINARY_DIR}/pcre2_test.sh)
  921. IF(PCRE2_BUILD_PCRE2GREP)
  922. ADD_TEST(pcre2_grep_test sh.exe ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh)
  923. ENDIF(PCRE2_BUILD_PCRE2GREP)
  924. ENDIF("$ENV{OSTYPE}" STREQUAL "msys")
  925. ENDIF(WIN32)
  926. # Changed to accommodate testing whichever location was just built
  927. IF(PCRE2_SUPPORT_JIT)
  928. ADD_TEST(pcre2_jit_test pcre2_jit_test)
  929. ENDIF(PCRE2_SUPPORT_JIT)
  930. IF(PCRE2_BUILD_PCRE2_8)
  931. ADD_TEST(pcre2posix_test pcre2posix_test)
  932. ENDIF(PCRE2_BUILD_PCRE2_8)
  933. ENDIF(PCRE2_BUILD_TESTS)
  934. # Installation
  935. SET(CMAKE_INSTALL_ALWAYS 1)
  936. INSTALL(TARGETS ${targets}
  937. RUNTIME DESTINATION bin
  938. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  939. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
  940. INSTALL(FILES ${pkg_config_files} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
  941. INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/pcre2-config"
  942. DESTINATION bin
  943. # Set 0755 permissions
  944. PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
  945. INSTALL(FILES ${PCRE2_HEADERS} ${PCRE2POSIX_HEADERS} DESTINATION include)
  946. # CMake config files.
  947. set(PCRE2_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcre2-config.cmake.in)
  948. set(PCRE2_CONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/pcre2-config.cmake)
  949. configure_file(${PCRE2_CONFIG_IN} ${PCRE2_CONFIG_OUT} @ONLY)
  950. set(PCRE2_CONFIG_VERSION_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcre2-config-version.cmake.in)
  951. set(PCRE2_CONFIG_VERSION_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/pcre2-config-version.cmake)
  952. configure_file(${PCRE2_CONFIG_VERSION_IN} ${PCRE2_CONFIG_VERSION_OUT} @ONLY)
  953. install(FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT} DESTINATION cmake)
  954. FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
  955. FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
  956. FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
  957. INSTALL(FILES ${man1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
  958. INSTALL(FILES ${man3} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
  959. INSTALL(FILES ${html} DESTINATION share/doc/pcre2/html)
  960. IF(MSVC AND INSTALL_MSVC_PDB)
  961. INSTALL(FILES ${dll_pdb_files} DESTINATION bin CONFIGURATIONS RelWithDebInfo)
  962. INSTALL(FILES ${dll_pdb_debug_files} DESTINATION bin CONFIGURATIONS Debug)
  963. ENDIF(MSVC AND INSTALL_MSVC_PDB)
  964. # Help, only for nice output
  965. IF(BUILD_STATIC_LIBS)
  966. SET(BUILD_STATIC_LIBS ON)
  967. ELSE(BUILD_STATIC_LIBS)
  968. SET(BUILD_STATIC_LIBS OFF)
  969. ENDIF(BUILD_STATIC_LIBS)
  970. IF(PCRE2_HEAP_MATCH_RECURSE)
  971. MESSAGE(WARNING "HEAP_MATCH_RECURSE is obsolete and does nothing.")
  972. ENDIF(PCRE2_HEAP_MATCH_RECURSE)
  973. IF(PCRE2_SHOW_REPORT)
  974. STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
  975. IF (CMAKE_C_FLAGS)
  976. SET(cfsp " ")
  977. ENDIF(CMAKE_C_FLAGS)
  978. MESSAGE(STATUS "")
  979. MESSAGE(STATUS "")
  980. MESSAGE(STATUS "PCRE2-${PCRE2_MAJOR}.${PCRE2_MINOR} configuration summary:")
  981. MESSAGE(STATUS "")
  982. MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
  983. MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
  984. MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
  985. MESSAGE(STATUS "")
  986. MESSAGE(STATUS " Build 8 bit PCRE2 library ....... : ${PCRE2_BUILD_PCRE2_8}")
  987. MESSAGE(STATUS " Build 16 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_16}")
  988. MESSAGE(STATUS " Build 32 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_32}")
  989. MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE2_SUPPORT_JIT}")
  990. MESSAGE(STATUS " Use SELinux allocator in JIT .... : ${PCRE2_SUPPORT_JIT_SEALLOC}")
  991. MESSAGE(STATUS " Enable Unicode support .......... : ${PCRE2_SUPPORT_UNICODE}")
  992. MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE2_NEWLINE}")
  993. MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE2_SUPPORT_BSR_ANYCRLF}")
  994. MESSAGE(STATUS " \\C is disabled .................. : ${PCRE2_NEVER_BACKSLASH_C}")
  995. MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE2_EBCDIC}")
  996. MESSAGE(STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE2_EBCDIC_NL25}")
  997. MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE2_REBUILD_CHARTABLES}")
  998. MESSAGE(STATUS " Internal link size .............. : ${PCRE2_LINK_SIZE}")
  999. MESSAGE(STATUS " Maximum variable lookbehind ..... : ${PCRE2_MAX_VARLOOKBEHIND}")
  1000. MESSAGE(STATUS " Parentheses nest limit .......... : ${PCRE2_PARENS_NEST_LIMIT}")
  1001. MESSAGE(STATUS " Heap limit ...................... : ${PCRE2_HEAP_LIMIT}")
  1002. MESSAGE(STATUS " Match limit ..................... : ${PCRE2_MATCH_LIMIT}")
  1003. MESSAGE(STATUS " Match depth limit ............... : ${PCRE2_MATCH_LIMIT_DEPTH}")
  1004. MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}")
  1005. MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}")
  1006. MESSAGE(STATUS " with PIC enabled ............. : ${PCRE2_STATIC_PIC}")
  1007. MESSAGE(STATUS " Build pcre2grep ................. : ${PCRE2_BUILD_PCRE2GREP}")
  1008. MESSAGE(STATUS " Enable JIT in pcre2grep ......... : ${PCRE2GREP_SUPPORT_JIT}")
  1009. MESSAGE(STATUS " Enable callouts in pcre2grep .... : ${PCRE2GREP_SUPPORT_CALLOUT}")
  1010. MESSAGE(STATUS " Enable callout fork in pcre2grep. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK}")
  1011. MESSAGE(STATUS " Buffer size for pcre2grep ....... : ${PCRE2GREP_BUFSIZE}")
  1012. MESSAGE(STATUS " Build tests (implies pcre2test .. : ${PCRE2_BUILD_TESTS}")
  1013. MESSAGE(STATUS " and pcre2grep)")
  1014. IF(ZLIB_FOUND)
  1015. MESSAGE(STATUS " Link pcre2grep with libz ........ : ${PCRE2_SUPPORT_LIBZ}")
  1016. ELSE(ZLIB_FOUND)
  1017. MESSAGE(STATUS " Link pcre2grep with libz ........ : Library not found" )
  1018. ENDIF(ZLIB_FOUND)
  1019. IF(BZIP2_FOUND)
  1020. MESSAGE(STATUS " Link pcre2grep with libbz2 ...... : ${PCRE2_SUPPORT_LIBBZ2}")
  1021. ELSE(BZIP2_FOUND)
  1022. MESSAGE(STATUS " Link pcre2grep with libbz2 ...... : Library not found" )
  1023. ENDIF(BZIP2_FOUND)
  1024. IF(EDITLINE_FOUND)
  1025. MESSAGE(STATUS " Link pcre2test with libeditline . : ${PCRE2_SUPPORT_LIBEDIT}")
  1026. ELSE(EDITLINE_FOUND)
  1027. MESSAGE(STATUS " Link pcre2test with libeditline . : Library not found" )
  1028. ENDIF(EDITLINE_FOUND)
  1029. IF(READLINE_FOUND)
  1030. MESSAGE(STATUS " Link pcre2test with libreadline . : ${PCRE2_SUPPORT_LIBREADLINE}")
  1031. ELSE(READLINE_FOUND)
  1032. MESSAGE(STATUS " Link pcre2test with libreadline . : Library not found" )
  1033. ENDIF(READLINE_FOUND)
  1034. MESSAGE(STATUS " Support Valgrind .................: ${PCRE2_SUPPORT_VALGRIND}")
  1035. IF(PCRE2_DISABLE_PERCENT_ZT)
  1036. MESSAGE(STATUS " Use %zu and %td ..................: OFF" )
  1037. ELSE(PCRE2_DISABLE_PERCENT_ZT)
  1038. MESSAGE(STATUS " Use %zu and %td ..................: AUTO" )
  1039. ENDIF(PCRE2_DISABLE_PERCENT_ZT)
  1040. IF(MINGW AND BUILD_SHARED_LIBS)
  1041. MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
  1042. MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
  1043. ENDIF(MINGW AND BUILD_SHARED_LIBS)
  1044. IF(MSVC)
  1045. MESSAGE(STATUS " Install MSVC .pdb files ..........: ${INSTALL_MSVC_PDB}")
  1046. ENDIF(MSVC)
  1047. MESSAGE(STATUS "")
  1048. ENDIF(PCRE2_SHOW_REPORT)
  1049. # end CMakeLists.txt