decrypt drsuapi attributes
[wireshark-sm.git] / cmake / modules / FindPCRE2.cmake
bloba7d80792b5a04c48701de94c600628f94efcb544
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")
22 endif()
24 find_path(PCRE2_INCLUDE_DIR
25         NAMES
26                 pcre2.h
27         HINTS
28                 ${PC_PCRE2_INCLUDE_DIRS}
29                 ${PCRE2_HINTS}/include
32 find_library(PCRE2_LIBRARY
33         NAMES
34                 pcre2-8
35         HINTS
36                 ${PC_PCRE2_LIBRARY_DIRS}
37                 ${PCRE2_HINTS}/lib
40 if (USE_REPOSITORY)
41         find_library(PCRE2_DEBUG_LIBRARY
42                 NAMES
43                         pcre2-8d
44                 HINTS
45                         ${PCRE2_HINTS}/debug/lib
46         )
47 else()
48         set (PCRE2_DEBUG_LIBRARY ${PCRE2_LIBRARY} CACHE FILEPATH "PCRE2 library")
49 endif()
51 include(FindPackageHandleStandardArgs)
52 find_package_handle_standard_args(PCRE2
53         REQUIRED_VARS   PCRE2_LIBRARY PCRE2_INCLUDE_DIR
54         VERSION_VAR     PC_PCRE2_VERSION
57 if(PCRE2_FOUND)
58         set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
59         set(PCRE2_DEBUG_LIBRARIES ${PCRE2_DEBUG_LIBRARY})
60         set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
61         if (USE_REPOSITORY)
62                 set (PCRE2_RELEASE_DLL_DIR "${PCRE2_HINTS}/bin"
63                         CACHE PATH "Path to PCRE2 release DLL"
64                 )
65                 file(GLOB _pcre2_release_dll RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
66                         "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.dll"
67                 )
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"
71                 )
72                 file(GLOB _pcre2_release_pdb RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
73                         "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.pdb"
74                 )
75                 set (PCRE2_RELEASE_PDB ${_pcre2_release_pdb}
76                         CACHE FILEPATH "PCRE2 release PDB file name"
77                 )
79                 set (PCRE2_DEBUG_DLL_DIR "${PCRE2_HINTS}/debug/bin"
80                         CACHE PATH "Path to PCRE2 debug DLL"
81                 )
82                 file(GLOB _pcre2_debug_dll RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
83                         "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.dll"
84                 )
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"
88                 )
89                 file(GLOB _pcre2_debug_pdb RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
90                         "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.pdb"
91                 )
92                 set (PCRE2_DEBUG_PDB ${_pcre2_debug_pdb}
93                         CACHE FILEPATH "PCRE2 debug PDB file name"
94                 )
95                 mark_as_advanced(PCRE2_RELEASE_DLL_DIR PCRE2_RELEASE_DLL PCRE2_PDB PCRE2_DEBUG_DLL_DIR PCRE2_DEBUG_DLL)
96         endif()
97 else()
98         set(PCRE2_LIBRARIES)
99         set(PCRE2_INCLUDE_DIRS)
100 endif()
102 mark_as_advanced(PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS)