diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 10:09:55 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-19 11:12:13 +0100 |
commit | 69ecdad5a494957afcf2447cc6edac6934f2b1b6 (patch) | |
tree | fdf4e7fd67ef9af2aefbe488a0453a3f9aaf31af /cmake | |
parent | 622166c446f25db02b31ce6059fae96cf0b6eeb2 (diff) | |
download | libgit2-69ecdad5a494957afcf2447cc6edac6934f2b1b6.tar.gz |
regex: use system PCRE if available
Attempt to locate a system-installed version of PCRE and use its POSIX
compatibility layer, if possible.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindPCRE.cmake | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cmake/Modules/FindPCRE.cmake b/cmake/Modules/FindPCRE.cmake new file mode 100644 index 000000000..74ed61e53 --- /dev/null +++ b/cmake/Modules/FindPCRE.cmake @@ -0,0 +1,38 @@ +# Copyright (C) 2007-2009 LuaDist. +# Created by Peter Kapec <kapecp@gmail.com> +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Note: +# Searching headers and libraries is very simple and is NOT as powerful as scripts +# distributed with CMake, because LuaDist defines directories to search for. +# Everyone is encouraged to contact the author with improvements. Maybe this file +# becomes part of CMake distribution sometimes. + +# - Find pcre +# Find the native PCRE headers and libraries. +# +# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + +# Look for the header file. +FIND_PATH(PCRE_INCLUDE_DIR NAMES pcreposix.h) + +# Look for the library. +FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) +FIND_LIBRARY(PCRE_POSIX_LIBRARY NAMES pcreposix) + +# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_POSIX_LIBRARY PCRE_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(PCRE_FOUND) + SET(PCRE_LIBRARIES ${PCRE_LIBRARY} ${PCRE_POSIX_LIBRARY}) + SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) +ELSE(PCRE_FOUND) + SET(PCRE_LIBRARIES) + SET(PCRE_INCLUDE_DIRS) +ENDIF(PCRE_FOUND) + +MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES) |