Logo AND Algorithmique Numérique Distribuée

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