Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
79aaa78810ca408372c2c7a72a4e55941904ad89
[simgrid.git] / buildtools / Cmake / Modules / FindSimGrid.cmake
1 #IF YOU HAVE INSTALL SIMGRID IN A SPECIAL DIRECTORY
2 #YOU CAN SPECIFY SIMGRID_ROOT OR GRAS_ROOT
3
4 # TO CALL THIS FILE USE
5         #set(CMAKE_MODULE_PATH 
6         #${CMAKE_MODULE_PATH}
7         #${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
8         #)
9
10 find_library(HAVE_SIMGRID_LIB
11     NAME simgrid
12     HINTS
13     $ENV{LD_LIBRARY_PATH}
14     $ENV{GRAS_ROOT}
15         $ENV{SIMGRID_ROOT}
16     PATH_SUFFIXES lib64 lib
17     PATHS
18     /opt
19     /opt/local
20     /opt/csw
21     /sw
22     /usr
23 )
24
25 find_path(HAVE_GRAS_H gras.h
26     HINTS
27     $ENV{GRAS_ROOT}
28         $ENV{SIMGRID_ROOT}
29     PATH_SUFFIXES include
30     PATHS
31     /opt
32     /opt/local
33     /opt/csw
34     /sw
35     /usr
36 )
37
38 find_program(HAVE_TESH
39         NAMES tesh
40         HINTS
41         $ENV{GRAS_ROOT}
42         $ENV{SIMGRID_ROOT}
43         PATH_SUFFIXES bin
44         PATHS
45         /opt
46         /opt/local
47         /opt/csw
48         /sw
49         /usr
50 )
51
52 find_program(HAVE_GRAS_STUB
53         NAMES gras_stub_generator
54         HINTS
55         $ENV{GRAS_ROOT}
56         $ENV{SIMGRID_ROOT}
57         PATH_SUFFIXES bin
58         PATHS
59         /opt
60         /opt/local
61         /opt/csw
62         /sw
63         /usr
64 )
65
66 message(STATUS "Looking for lib SimGrid")
67 if(HAVE_SIMGRID_LIB)
68   message(STATUS "Looking for lib SimGrid - found")
69   if(CMAKE_CACHE_MAJOR_VERSION EQUAL "2" AND CMAKE_CACHE_MINOR_VERSION GREATER "7") #need cmake version 2.8
70           get_filename_component(simgrid_version ${HAVE_SIMGRID_LIB} REALPATH)
71           string(REPLACE "${HAVE_SIMGRID_LIB}." "" simgrid_version "${simgrid_version}")
72           string(REGEX MATCH "^[0-9]" SIMGRID_MAJOR_VERSION "${simgrid_version}")
73           string(REGEX MATCH "^[0-9].[0-9]" SIMGRID_MINOR_VERSION "${simgrid_version}")
74           string(REGEX MATCH "^[0-9].[0-9].[0-9]" SIMGRID_PATCH_VERSION "${simgrid_version}")
75           string(REGEX REPLACE "^${SIMGRID_MINOR_VERSION}." "" SIMGRID_PATCH_VERSION "${SIMGRID_PATCH_VERSION}") 
76           string(REGEX REPLACE "^${SIMGRID_MAJOR_VERSION}." "" SIMGRID_MINOR_VERSION "${SIMGRID_MINOR_VERSION}")
77           message(STATUS "Simgrid version : ${SIMGRID_MAJOR_VERSION}.${SIMGRID_MINOR_VERSION}")
78   endif(CMAKE_CACHE_MAJOR_VERSION EQUAL "2" AND CMAKE_CACHE_MINOR_VERSION GREATER "7")
79 else(HAVE_SIMGRID_LIB)
80   message(STATUS "Looking for lib SimGrid - not found")
81 endif(HAVE_SIMGRID_LIB)
82
83 message(STATUS "Looking for gras.h")
84 if(HAVE_GRAS_H)
85 message(STATUS "Looking for gras.h - found")
86 else(HAVE_GRAS_H)
87 message(STATUS "Looking for gras.h - not found")
88 endif(HAVE_GRAS_H)
89
90 if(HAVE_TESH)
91 message(STATUS "Found Tesh: ${HAVE_TESH}")
92 endif(HAVE_TESH)
93
94 if(HAVE_GRAS_STUB)
95 message(STATUS "Found gras_stub_generator: ${HAVE_GRAS_STUB}")
96 endif(HAVE_GRAS_STUB)