Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix on libpcre detection by cmake
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
index 065e67f..f7f8daf 100644 (file)
@@ -181,21 +181,27 @@ mark_as_advanced(HAVE_CGRAPH_H)
 if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
        string(REGEX REPLACE "/libcgraph.*" "" lib_cgraph ${HAVE_CGRAPH_LIB})
        string(REPLACE "/cgraph.h" "" file_cgraph_h ${HAVE_CGRAPH_H})
-               
        string(REGEX MATCH "-I${file_cgraph_h} " operation "${CMAKE_C_FLAGS}")
        if(NOT operation)
                SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${file_cgraph_h} ")
        endif(NOT operation)
+       string(REGEX MATCH "-L${lib_cgraph} " operation "${CMAKE_C_FLAGS}")
+       if(NOT operation)
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${lib_cgraph} ")
+       endif(NOT operation)
        
 endif(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
 
 #--------------------------------------------------------------------------------------------------
 ### Initialize of pcre
-find_library(PCRE_LIB pcre "/usr/lib/" )
+find_library(PATH_PCRE_LIB pcre "/usr/lib/")
 
 if(PATH_PCRE_LIB)
-       string(REGEX REPLACE "libpcre.*[.]so$" "" PATHLIBPCRE "${PCRE_LIB}")
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
+       string(REGEX REPLACE "/libpcre.*[.]so$" "" PATHLIBPCRE "${PCRE_LIB}")
+               string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}")
+               if(NOT operation)
+                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ")
+               endif(NOT operation)
        set(HAVE_PCRE_LIB 1)
 endif(PATH_PCRE_LIB)