2 # - Find PCRE2 libraries
4 # PCRE2_INCLUDE_DIRS - where to find PCRE2 headers.
5 # PCRE2_LIBRARIES - List of libraries when using PCRE2.
6 # PCRE2_FOUND - True if PCRE2 is found.
7 # PCRE2_RELEASE_DLL_DIR - (Windows) Path to the PCRE2 release DLL
8 # PCRE2_RELEASE_DLL - (Windows) Name of the PCRE2 release DLL
9 # PCRE2_DEBUG_DLL_DIR - (Windows) Path to the PCRE2 debug DLL
10 # PCRE2_DEBUG_DLL - (Windows) Name of the PCRE2 debug DLL
12 # Note that the "8" in "libpcre2-8" refers to "PCRE library version 2 with
13 # support for 8-bit code units".
15 include( FindWSWinLibs )
16 # PCRE2 is included with GLib2
17 FindWSWinLibs( "vcpkg-export-.*" "PCRE2_HINTS" )
19 if( NOT USE_REPOSITORY)
20 find_package(PkgConfig QUIET)
21 pkg_search_module(PC_PCRE2 QUIET "libpcre2-8")
24 find_path(PCRE2_INCLUDE_DIR
28 ${PC_PCRE2_INCLUDE_DIRS}
29 ${PCRE2_HINTS}/include
32 find_library(PCRE2_LIBRARY
36 ${PC_PCRE2_LIBRARY_DIRS}
41 find_library(PCRE2_DEBUG_LIBRARY
45 ${PCRE2_HINTS}/debug/lib
48 set (PCRE2_DEBUG_LIBRARY ${PCRE2_LIBRARY} CACHE FILEPATH "PCRE2 library")
51 include(FindPackageHandleStandardArgs)
52 find_package_handle_standard_args(PCRE2
53 REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR
54 VERSION_VAR PC_PCRE2_VERSION
58 set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
59 set(PCRE2_DEBUG_LIBRARIES ${PCRE2_DEBUG_LIBRARY})
60 set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
62 set (PCRE2_RELEASE_DLL_DIR "${PCRE2_HINTS}/bin"
63 CACHE PATH "Path to PCRE2 release DLL"
65 file(GLOB _pcre2_release_dll RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
66 "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.dll"
68 set (PCRE2_RELEASE_DLL ${_pcre2_release_dll}
69 # We're storing filenames only. Should we use STRING instead?
70 CACHE FILEPATH "PCRE2 release DLL file name"
72 file(GLOB _pcre2_release_pdb RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
73 "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.pdb"
75 set (PCRE2_RELEASE_PDB ${_pcre2_release_pdb}
76 CACHE FILEPATH "PCRE2 release PDB file name"
79 set (PCRE2_DEBUG_DLL_DIR "${PCRE2_HINTS}/debug/bin"
80 CACHE PATH "Path to PCRE2 debug DLL"
82 file(GLOB _pcre2_debug_dll RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
83 "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.dll"
85 set (PCRE2_DEBUG_DLL ${_pcre2_debug_dll}
86 # We're storing filenames only. Should we use STRING instead?
87 CACHE FILEPATH "PCRE2 debug DLL file name"
89 file(GLOB _pcre2_debug_pdb RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
90 "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.pdb"
92 set (PCRE2_DEBUG_PDB ${_pcre2_debug_pdb}
93 CACHE FILEPATH "PCRE2 debug PDB file name"
95 mark_as_advanced(PCRE2_RELEASE_DLL_DIR PCRE2_RELEASE_DLL PCRE2_PDB PCRE2_DEBUG_DLL_DIR PCRE2_DEBUG_DLL)
99 set(PCRE2_INCLUDE_DIRS)
102 mark_as_advanced(PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS)