blob: 8f60daa232ea112ed9b6c5e8c1f79c72e137ecf7 [file] [log] [blame]
Radek Krejci54579462019-04-30 12:47:06 +02001# - Find pcre
2# Find the native PCRE2 headers and libraries.
3#
4# PCRE2_INCLUDE_DIRS - where to find pcre.h, etc.
5# PCRE2_LIBRARIES - List of libraries when using pcre.
6# PCRE2_FOUND - True if pcre found.
7
8# Look for the header file.
9FIND_PATH(PCRE2_INCLUDE_DIR pcre2.h)
10
11# Look for the library.
12FIND_LIBRARY(PCRE2_LIBRARY NAMES libpcre2.a pcre2-8)
13
Radek Krejcid9e68c42019-05-31 16:26:26 +020014# Check required version
15execute_process(COMMAND pcre2-config --version OUTPUT_VARIABLE PCRE2_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
16
Radek Krejci54579462019-04-30 12:47:06 +020017# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE.
18INCLUDE(FindPackageHandleStandardArgs)
Radek Krejcid9e68c42019-05-31 16:26:26 +020019FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR VERSION_VAR PCRE2_VERSION)
Radek Krejci54579462019-04-30 12:47:06 +020020
21# Copy the results to the output variables.
22IF(PCRE2_FOUND)
23 SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
24 SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
25ELSE(PCRE2_FOUND)
26 SET(PCRE_LIBRARIES)
27 SET(PCRE_INCLUDE_DIRS)
28ENDIF(PCRE2_FOUND)
29
30MARK_AS_ADVANCED(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES)