Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use of SIMGRID_LIB_PATH and not SIMGRID_LIB
[simgrid.git] / FindSimGrid.cmake
1 #IF YOU HAVE INSTALL SIMGRID IN A SPECIAL DIRECTORY
2 #YOU CAN SPECIFY SIMGRID_ROOT OR GRAS_ROOT
3
4 find_library(SIMGRID_LIB
5     NAME simgrid
6     HINTS
7         $ENV{SIMGRID_ROOT}
8     PATH_SUFFIXES lib
9 )
10
11 find_path(SIMGRID_INCLUDES msg/msg.h
12     HINTS
13         $ENV{SIMGRID_ROOT}
14     PATH_SUFFIXES include
15 )
16
17 message(STATUS "Looking for lib SimGrid")
18 if(SIMGRID_LIB)
19   message(STATUS "Looking for lib SimGrid - found")  
20   get_filename_component(simgrid_version ${SIMGRID_LIB} REALPATH)
21   string(REPLACE "${SIMGRID_LIB}." "" simgrid_version "${simgrid_version}")       
22   string(REGEX MATCH "^[0-9]" SIMGRID_MAJOR_VERSION "${simgrid_version}")
23   string(REGEX MATCH "^[0-9].[0-9]" SIMGRID_MINOR_VERSION "${simgrid_version}")
24   string(REGEX MATCH "^[0-9].[0-9].[0-9]" SIMGRID_PATCH_VERSION "${simgrid_version}")
25   string(REGEX REPLACE "^${SIMGRID_MINOR_VERSION}." "" SIMGRID_PATCH_VERSION "${SIMGRID_PATCH_VERSION}") 
26   string(REGEX REPLACE "^${SIMGRID_MAJOR_VERSION}." "" SIMGRID_MINOR_VERSION "${SIMGRID_MINOR_VERSION}")
27 else(SIMGRID_LIB)
28   message(STATUS "Looking for lib SimGrid - not found")
29 endif(SIMGRID_LIB)
30
31 string(REGEX REPLACE "libsimgrid.*" "" SIMGRID_LIB_PATH "${SIMGRID_LIB}")
32
33 message(STATUS "Simgrid         : ${SIMGRID_LIB}")
34 message(STATUS "Simgrid_path    : ${SIMGRID_LIB_PATH}")
35 message(STATUS "Simgrid version : ${SIMGRID_MAJOR_VERSION}.${SIMGRID_MINOR_VERSION}")
36
37 message(STATUS "Looking for msg.h")
38 if(SIMGRID_INCLUDES)
39   message(STATUS "Looking for msg.h - found")
40 else(SIMGRID_INCLUDES)
41   message(STATUS "Looking for msg.h - not found")
42 endif(SIMGRID_INCLUDES)
43
44 if(SIMGRID_LIB AND SIMGRID_INCLUDES)
45 else(SIMGRID_LIB AND SIMGRID_INCLUDES)
46     message(FATAL_ERROR "Unable to find both the library and the include files. Setting the environment variable SIMGRID_ROOT may help.")
47 endif(SIMGRID_LIB AND SIMGRID_INCLUDES)