Logo AND Algorithmique Numérique Distribuée

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