5 # Find the native PCRE includes and library
7 # PCRE_INCLUDE_DIR - where to find pcre.h, etc.
8 # PCRE_LIBRARY - Path to the pcre library.
9 # PCRE_FOUND - True if pcre found.
13 # Already in cache, be silent
14 SET(PCRE_FIND_QUIETLY TRUE)
15 ENDIF (PCRE_INCLUDE_DIR)
17 FIND_PATH(SYSTEM_PCRE_INCLUDE_DIR pcre.h)
20 FIND_LIBRARY(SYSTEM_PCRE_LIBRARY NAMES ${PCRE_NAMES} )
22 # handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
23 # all listed variables are TRUE
24 INCLUDE(FindPackageHandleStandardArgs)
25 FIND_PACKAGE_HANDLE_STANDARD_ARGS(
26 PCRE DEFAULT_MSG SYSTEM_PCRE_LIBRARY SYSTEM_PCRE_INCLUDE_DIR
29 # Make sure it's got the jit enabled. If not, don't use it.
31 INCLUDE(CheckCSourceRuns)
32 SET(CMAKE_REQUIRED_LIBRARIES pcre)
33 CHECK_C_SOURCE_RUNS("#include <pcre.h>
36 pcre_config(PCRE_CONFIG_JIT, &has_jit);
37 return has_jit ? 0 : 1;
39 " SYSTEM_PCRE_HAS_JIT)
42 IF(NOT SYSTEM_PCRE_HAS_JIT)
44 "System PCRE does not have JIT enabled - will use hhvm-third-party/pcre")
45 UNSET(PCRE_INCLUDE_DIR CACHE)
46 UNSET(PCRE_LIBRARY CACHE)
48 # This is used to configure bundled pcre
49 SET(PCRE_SUPPORT_JIT ON CACHE BOOL "")
50 SET(PCRE_SUPPORT_UTF ON CACHE BOOL "")
51 SET(PCRE_SUPPORT_UNICODE_PROPERTIES ON CACHE BOOL "")
53 SET(PCRE_INCLUDE_DIR ${SYSTEM_PCRE_INCLUDE_DIR}
54 CACHE PATH "PCRE include directory")
55 SET(PCRE_LIBRARY ${SYSTEM_PCRE_LIBRARY} CACHE FILEPATH "PCRE library")
58 MARK_AS_ADVANCED( PCRE_LIBRARY PCRE_INCLUDE_DIR )