Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e2537eb1c6950ae1f2489cbd577733cbcbe30de9
[simgrid.git] / buildtools / Cmake / Modules / FindPCRE.cmake
1 find_library(PATH_PCRE_LIB 
2         NAMES pcre
3     HINTS
4     $ENV{LD_LIBRARY_PATH}
5     $ENV{PCRE_LIBRARY_PATH}
6     PATH_SUFFIXES lib/ GnuWin32/lib
7     PATHS
8     /opt
9     /opt/local
10     /opt/csw
11     /sw
12     /usr
13     /lib)
14     
15 find_path(PATH_PCRE_H "pcre.h"
16     HINTS
17     $ENV{LD_LIBRARY_PATH}
18     $ENV{PCRE_LIBRARY_PATH}
19     PATH_SUFFIXES include/ GnuWin32/include
20     PATHS
21     /opt
22     /opt/local
23     /opt/csw
24     /sw
25     /usr)
26     
27 set(HAVE_PCRE_LIB 0)
28 if(PATH_PCRE_LIB AND PATH_PCRE_H)
29        string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
30        string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
31        string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
32            if(NOT operation)
33                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
34            endif(NOT operation)
35            string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
36            if(NOT operation)
37                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
38            endif(NOT operation)    
39        set(HAVE_PCRE_LIB 1)
40 else(PATH_PCRE_LIB)
41                 message(STATUS "Warning : You should install libpcre (please install the libpcre3-dev package or equivalent)")
42 endif(PATH_PCRE_LIB AND PATH_PCRE_H)
43     
44 message(STATUS "Looking for pcre.h")
45 if(PATH_PCRE_H)
46 message(STATUS "Looking for pcre.h - found")
47 else(PATH_PCRE_H)
48 message(STATUS "Looking for pcre.h - not found")
49 endif(PATH_PCRE_H)
50
51 message(STATUS "Looking for lib pcre")
52 if(PATH_PCRE_LIB)
53 message(STATUS "Looking for lib pcre - found")
54 else(PATH_PCRE_LIB)
55 message(STATUS "Looking for lib pcre - not found")
56 endif(PATH_PCRE_LIB)