Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use correct type for variables, and avoid loosing precision.
[simgrid.git] / tools / cmake / Modules / FindGraphviz.cmake
1 find_path(HAVE_CGRAPH_H cgraph.h
2   HINTS  $ENV{LD_LIBRARY_PATH}
3   PATH_SUFFIXES include/graphviz include
4   PATHS         /opt;/opt/local;/opt/csw;/sw;/usr
5 )
6
7 find_library(HAVE_CGRAPH_LIB
8   NAME          cgraph
9   HINTS         $ENV{LD_LIBRARY_PATH}
10   PATH_SUFFIXES lib/graphviz lib
11   PATHS         /opt;/opt/local;/opt/csw;/sw;/usr)
12
13 find_library(HAVE_CDT_LIB
14   NAME          cdt
15   HINTS         $ENV{LD_LIBRARY_PATH}
16   PATH_SUFFIXES lib/graphviz lib
17   PATHS         /opt;/opt/local;/opt/csw;/sw;/usr)
18
19 if(HAVE_CDT_LIB AND HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
20   string(REGEX REPLACE "/libcgraph.*" "" lib_graphviz ${HAVE_CGRAPH_LIB})
21
22   string(REPLACE "/graphviz/cgraph.h" "" file_graphviz_h ${HAVE_CGRAPH_H})
23   string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h})
24
25   include_directories(${file_graphviz_h} ${file_graphviz_h}/graphviz)
26   link_directories(${lib_graphviz})
27
28   set(HAVE_GRAPHVIZ "1")
29 else()
30   set(HAVE_GRAPHVIZ "0")
31 endif()
32
33 mark_as_advanced(HAVE_GRAPHVIZ)
34 mark_as_advanced(HAVE_CGRAPH_H)
35 mark_as_advanced(HAVE_CGRAPH_LIB)
36 mark_as_advanced(HAVE_CDT_LIB)
37 unset(HAVE_CGRAPH_H)
38 unset(HAVE_CGRAPH_LIB)
39 unset(HAVE_CDT_LIB)
40
41 message(STATUS "Looking for graphviz")
42 if(HAVE_GRAPHVIZ)
43   message(STATUS "Looking for graphviz - found")
44 else()
45   message(STATUS "Looking for graphviz - not found (try installing libgraphviz-dev)")
46 endif()