diff options
author | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-06-29 12:26:51 +0000 |
---|---|---|
committer | flaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-06-29 12:26:51 +0000 |
commit | dd73c6ea546a8828653cdce38a52f575cbdd3b96 (patch) | |
tree | 7c388def15aaf5e09e73f563ffa39c72d7c28c2f /3rdparty/pcre/FindPCRE.cmake | |
parent | a9492cf82f696af37f3258e19d7767f705708e63 (diff) | |
download | hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.gz hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.bz2 hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.xz hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.zip |
* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14872 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to '3rdparty/pcre/FindPCRE.cmake')
-rw-r--r-- | 3rdparty/pcre/FindPCRE.cmake | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/3rdparty/pcre/FindPCRE.cmake b/3rdparty/pcre/FindPCRE.cmake new file mode 100644 index 000000000..cb4d9177b --- /dev/null +++ b/3rdparty/pcre/FindPCRE.cmake @@ -0,0 +1,35 @@ +# - Find pcre +# Find the native PCRE includes and library +# +# PCRE_INCLUDE_DIRS - where to find pcre.h +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + + +find_path( PCRE_INCLUDE_DIR pcre.h ) + +set( PCRE_NAMES pcre ) +find_library( PCRE_LIBRARY NAMES ${PCRE_NAMES} ) +mark_as_advanced( PCRE_LIBRARY PCRE_INCLUDE_DIR ) + +if( PCRE_INCLUDE_DIR AND EXISTS "${PCRE_INCLUDE_DIR}/pcre.h" ) + file( STRINGS "${PCRE_INCLUDE_DIR}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) + string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) + string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) + + set( PCRE_VERSION_STRING "${PCRE_MAJOR}.${PCRE_MINOR}" ) + set( PCRE_VERSION_MAJOR "${PCRE_MAJOR}" ) + set( PCRE_VERSION_MINOR "${PCRE_MINOR}" ) +endif() + +# 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 + REQUIRED_VARS PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION_STRING ) + +if( PCRE_FOUND ) + set( PCRE_LIBRARIES ${PCRE_LIBRARY} ) + set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) +endif() |