Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a verification on pcre.h
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
index ad724e0..17c6769 100644 (file)
@@ -207,18 +207,24 @@ endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
 
 #--------------------------------------------------------------------------------------------------
 ### Initialize of pcre
-find_library(PATH_PCRE_LIB pcre "/usr/lib/")
+find_library(PATH_PCRE_LIB pcre)
+find_file(PATH_PCRE_H "pcre.h")
 set(HAVE_PCRE_LIB 0)
-if(PATH_PCRE_LIB)
+if(PATH_PCRE_LIB AND PATH_PCRE_H)
        string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}")
-               string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
-               if(NOT operation)
+       string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
+       string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
+          if(NOT operation)
                        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
-               endif(NOT operation)
+          endif(NOT operation)
+          string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
+          if(NOT operation)
+                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
+          endif(NOT operation)    
        set(HAVE_PCRE_LIB 1)
 else(PATH_PCRE_LIB)
                message("You should install libpcre (please install the libpcre3-dev package or equivalent)")
-endif(PATH_PCRE_LIB)
+endif(PATH_PCRE_LIB AND PATH_PCRE_H)
 
 #--------------------------------------------------------------------------------------------------
 ### Initialize of CONTEXT THREADS