Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correctely search for pcre and pthread on windows.
[simgrid.git] / buildtools / Cmake / Modules / FindPcreWin.cmake
1 # LIB libpcre.dll
2 find_library(PATH_PCRE_LIB 
3         NAMES pcre
4     HINTS
5     $ENV{SIMGRID_PCRE_LIBRARY_PATH}
6     $ENV{PCRE_LIBRARY_PATH}
7     PATH_SUFFIXES bin/ GnuWin32/bin
8     )
9
10 find_path(PATH_PCRE_H "pcre.h"
11     HINTS
12     $ENV{SIMGRID_PCRE_LIBRARY_PATH}
13     $ENV{PCRE_LIBRARY_PATH}
14     PATH_SUFFIXES include/ GnuWin32/include
15     )
16     
17 message(STATUS "Looking for pcre.h")
18 if(PATH_PCRE_H)
19 message(STATUS "Looking for pcre.h - found")
20 else(PATH_PCRE_H)
21 message(STATUS "Looking for pcre.h - not found")
22 endif(PATH_PCRE_H)
23
24 message(STATUS "Looking for lib pcre")
25 if(PATH_PCRE_LIB)
26 message(STATUS "Looking for lib pcre - found")
27 else(PATH_PCRE_LIB)
28 message(STATUS "Looking for lib pcre - not found")
29 endif(PATH_PCRE_LIB)
30
31 if(PATH_PCRE_LIB AND PATH_PCRE_H)
32        string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}")
33            string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}")
34            if(NOT operation)
35                         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ")
36            endif(NOT operation)    
37 else(PATH_PCRE_LIB)
38            message(FATAL_ERROR "Please install the pcre package before using SimGrid.")
39 endif(PATH_PCRE_LIB AND PATH_PCRE_H)
40
41 mark_as_advanced(PATH_PCRE_H)
42 mark_as_advanced(PATH_PCRE_LIB)