From 9fc8b732737f139d3e466510d75668ab45578960 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 8 Mar 2016 21:02:53 +0100 Subject: sync with upstream --- project/cmake/modules/FindPCRE.cmake | 91 ++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 project/cmake/modules/FindPCRE.cmake (limited to 'project/cmake/modules/FindPCRE.cmake') diff --git a/project/cmake/modules/FindPCRE.cmake b/project/cmake/modules/FindPCRE.cmake new file mode 100644 index 0000000..54c4ab4 --- /dev/null +++ b/project/cmake/modules/FindPCRE.cmake @@ -0,0 +1,91 @@ +#.rst: +# FindPCRE +# -------- +# Finds the PCRECPP library +# +# This will will define the following variables:: +# +# PCRE_FOUND - system has libpcrecpp +# PCRE_INCLUDE_DIRS - the libpcrecpp include directory +# PCRE_LIBRARIES - the libpcrecpp libraries +# PCRE_DEFINITIONS - the libpcrecpp definitions +# +# and the following imported targets:: +# +# PCRE::PCRECPP - The PCRECPP library +# PCRE::PCRE - The PCRE library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PCRE libpcrecpp QUIET) +endif() + +find_path(PCRE_INCLUDE_DIR pcrecpp.h + PATHS ${PC_PCRE_INCLUDEDIR}) +find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_RELEASE NAMES pcre + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_DEBUG NAMES pcred + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +set(PCRE_VERSION ${PC_PCRE_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(PCRECPP) +select_library_configurations(PCRE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PCRE + REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION) + +if(PCRE_FOUND) + set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY}) + set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) + if(WIN32) + set(PCRE_DEFINITIONS -DPCRE_STATIC=1) + endif() + + if(NOT TARGET PCRE::PCRE) + add_library(PCRE::PCRE UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") + if(WIN32) + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1) + endif() + + endif() + if(NOT TARGET PCRE::PCRECPP) + add_library(PCRE::PCRECPP UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRECPP PROPERTIES + INTERFACE_LINK_LIBRARIES PCRE::PCRE) + endif() +endif() + +mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY) -- cgit v1.2.3