|
| 1 | +# - Try to find the PCRE regular expression library |
| 2 | +# Once done this will define |
| 3 | +# |
| 4 | +# PCRE_FOUND - system has the PCRE library |
| 5 | +# PCRE_INCLUDE_DIR - the PCRE include directory |
| 6 | +# PCRE_LIBRARIES - The libraries needed to use PCRE |
| 7 | + |
| 8 | +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> |
| 9 | +# |
| 10 | +# Redistribution and use is allowed according to the terms of the BSD license. |
| 11 | +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
| 12 | + |
| 13 | + |
| 14 | +if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) |
| 15 | + # Already in cache, be silent |
| 16 | + set(PCRE_FIND_QUIETLY TRUE) |
| 17 | +endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY) |
| 18 | + |
| 19 | + |
| 20 | +if (NOT WIN32) |
| 21 | + # use pkg-config to get the directories and then use these values |
| 22 | + # in the FIND_PATH() and FIND_LIBRARY() calls |
| 23 | + find_package(PkgConfig) |
| 24 | + |
| 25 | + pkg_check_modules(PC_PCRE QUIET libpcre) |
| 26 | + |
| 27 | + set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER}) |
| 28 | + |
| 29 | +endif (NOT WIN32) |
| 30 | + |
| 31 | +find_path(PCRE_INCLUDE_DIR pcre.h |
| 32 | + HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS} |
| 33 | + PATH_SUFFIXES pcre) |
| 34 | + |
| 35 | +find_library(PCRE_PCRE_LIBRARY NAMES pcre pcred HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) |
| 36 | + |
| 37 | +find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix pcreposixd HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS}) |
| 38 | + |
| 39 | +include(FindPackageHandleStandardArgs) |
| 40 | +find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY ) |
| 41 | + |
| 42 | +set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY}) |
| 43 | + |
| 44 | +mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY) |
0 commit comments