Radek Krejci | 5457946 | 2019-04-30 12:47:06 +0200 | [diff] [blame] | 1 | # - 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. |
| 9 | FIND_PATH(PCRE2_INCLUDE_DIR pcre2.h) |
| 10 | |
| 11 | # Look for the library. |
| 12 | FIND_LIBRARY(PCRE2_LIBRARY NAMES libpcre2.a pcre2-8) |
| 13 | |
Radek Krejci | d9e68c4 | 2019-05-31 16:26:26 +0200 | [diff] [blame] | 14 | # Check required version |
| 15 | execute_process(COMMAND pcre2-config --version OUTPUT_VARIABLE PCRE2_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 16 | |
Radek Krejci | 5457946 | 2019-04-30 12:47:06 +0200 | [diff] [blame] | 17 | # Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. |
| 18 | INCLUDE(FindPackageHandleStandardArgs) |
Radek Krejci | d9e68c4 | 2019-05-31 16:26:26 +0200 | [diff] [blame] | 19 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR VERSION_VAR PCRE2_VERSION) |
Radek Krejci | 5457946 | 2019-04-30 12:47:06 +0200 | [diff] [blame] | 20 | |
| 21 | # Copy the results to the output variables. |
| 22 | IF(PCRE2_FOUND) |
| 23 | SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY}) |
| 24 | SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR}) |
| 25 | ELSE(PCRE2_FOUND) |
| 26 | SET(PCRE_LIBRARIES) |
| 27 | SET(PCRE_INCLUDE_DIRS) |
| 28 | ENDIF(PCRE2_FOUND) |
| 29 | |
| 30 | MARK_AS_ADVANCED(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES) |