aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/FindPCRE.cmake15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/FindPCRE.cmake b/modules/FindPCRE.cmake
index f0cc940d..af8aaff2 100644
--- a/modules/FindPCRE.cmake
+++ b/modules/FindPCRE.cmake
@@ -16,11 +16,20 @@ if (PCRE_INCLUDE_DIR AND PCRE_LIBRARIES AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE
set(PCRE_FIND_QUIETLY TRUE)
endif (PCRE_INCLUDE_DIR AND PCRE_LIBRARIES AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
-FIND_PATH(PCRE_INCLUDE_DIR pcre.h )
-FIND_LIBRARY(PCRE_PCRE_LIBRARY NAMES pcre)
+IF (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ INCLUDE(UsePkgConfig)
+
+ PKGCONFIG(libpcre _PCREIncDir _PCRELinkDir _PCRELinkFlags _PCRECflags)
+ENDIF (NOT WIN32)
-FIND_LIBRARY(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix)
+FIND_PATH(PCRE_INCLUDE_DIR pcre.h PATHS ${_PCREIncDir} PATH_SUFFIXES pcre)
+
+FIND_LIBRARY(PCRE_PCRE_LIBRARY NAMES pcre PATHS ${_PCRELinkDir})
+
+FIND_LIBRARY(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix PATHS ${_PCRELinkDir})
set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY} CACHE STRING "The libraries needed to use PCRE")