Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't try to use git with windows and cmake
[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   if(CMAKE_CACHE_MAJOR_VERSION EQUAL "2" AND CMAKE_CACHE_MINOR_VERSION GREATER "7") #need cmake version 2.8
21           get_filename_component(simgrid_version ${SIMGRID_LIB} REALPATH)
22           string(REPLACE "${SIMGRID_LIB}." "" simgrid_version "${simgrid_version}")
23           string(REGEX MATCH "^[0-9]" SIMGRID_MAJOR_VERSION "${simgrid_version}")
24           string(REGEX MATCH "^[0-9].[0-9]" SIMGRID_MINOR_VERSION "${simgrid_version}")
25           string(REGEX MATCH "^[0-9].[0-9].[0-9]" SIMGRID_PATCH_VERSION "${simgrid_version}")
26           string(REGEX REPLACE "^${SIMGRID_MINOR_VERSION}." "" SIMGRID_PATCH_VERSION "${SIMGRID_PATCH_VERSION}") 
27           string(REGEX REPLACE "^${SIMGRID_MAJOR_VERSION}." "" SIMGRID_MINOR_VERSION "${SIMGRID_MINOR_VERSION}")
28           message(STATUS "Simgrid version : ${SIMGRID_MAJOR_VERSION}.${SIMGRID_MINOR_VERSION}")
29   endif(CMAKE_CACHE_MAJOR_VERSION EQUAL "2" AND CMAKE_CACHE_MINOR_VERSION GREATER "7")
30 else(SIMGRID_LIB)
31   message(STATUS "Looking for lib SimGrid - not found")
32 endif(SIMGRID_LIB)
33
34 message(STATUS "Looking for msg.h")
35 if(SIMGRID_INCLUDES)
36   message(STATUS "Looking for msg.h - found")
37 else(SIMGRID_INCLUDES)
38   message(STATUS "Looking for msg.h - not found")
39 endif(SIMGRID_INCLUDES)
40
41 if(SIMGRID_LIB AND SIMGRID_INCLUDES)
42 else(SIMGRID_LIB AND SIMGRID_INCLUDES)
43     message(FATAL_ERROR "Unable to find both the library and the include files. Setting the environment variable SIMGRID_ROOT may help.")
44 endif(SIMGRID_LIB AND SIMGRID_INCLUDES)