]> SALOME platform Git repositories - modules/yacs.git/blob - adm/cmake/FindGraphviz.cmake
Salome HOME
20b510c7d528806e04de5bb9b191bd2d347907cc
[modules/yacs.git] / adm / cmake / FindGraphviz.cmake
1 # - Graphviz detection
2 #
3 # Output variables: GRAPHVIZ_EXECUTABLE   - where is executable 'dot' takes place.
4 #                   GRAPHVIZ_INCLUDE_DIRS - where to find headers.
5 #                   GRAPHVIZ_LIBRARIES    - where to get libraries.
6 #                   GRAPHVIZ_VERSION      - Graphviz version
7 #                   GRAPHVIZ_DEFINITIONS  - Graphviz definitions
8 #                   GRAPHVIZ_FOUND        - True if Graphviz was found.
9 #
10 ###########################################################################
11 # Copyright (C) 2013-2015  CEA/DEN, EDF R&D
12 #
13 # This library is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU Lesser General Public
15 # License as published by the Free Software Foundation; either
16 # version 2.1 of the License, or (at your option) any later version.
17 #
18 # This library is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # Lesser General Public License for more details.
22 #
23 # You should have received a copy of the GNU Lesser General Public
24 # License along with this library; if not, write to the Free Software
25 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
26 #
27 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
28 #
29
30 FIND_PROGRAM(GRAPHVIZ_EXECUTABLE dot)
31
32 FIND_PATH(GRAPHVIZ_INCLUDE_DIR NAMES graphviz/cgraph.h)
33 SET(GRAPHVIZ_INCLUDE_DIRS ${GRAPHVIZ_INCLUDE_DIR} ${GRAPHVIZ_INCLUDE_DIR}/graphviz)
34
35 FIND_LIBRARY(GRAPHVIZ_cdt_LIBRARY      NAMES cdt PATH_SUFFIXES bin)
36 FIND_LIBRARY(GRAPHVIZ_graph_LIBRARY    NAMES cgraph PATH_SUFFIXES bin)
37 FIND_LIBRARY(GRAPHVIZ_gvc_LIBRARY      NAMES gvc PATH_SUFFIXES bin)
38 FIND_LIBRARY(GRAPHVIZ_pathplan_LIBRARY NAMES pathplan PATH_SUFFIXES bin)
39
40 SET(GRAPHVIZ_LIBRARIES 
41   ${GRAPHVIZ_cdt_LIBRARY}
42   ${GRAPHVIZ_graph_LIBRARY} 
43   ${GRAPHVIZ_gvc_LIBRARY}
44   ${GRAPHVIZ_pathplan_LIBRARY}
45   )
46
47 IF(GRAPHVIZ_EXECUTABLE)
48   EXECUTE_PROCESS(COMMAND ${GRAPHVIZ_EXECUTABLE} "-V" ERROR_VARIABLE GRAPHVIZ_VERSION ERROR_STRIP_TRAILING_WHITESPACE)
49   STRING(REGEX REPLACE ".* ([0-9.]+) .*" "\\1" GRAPHVIZ_VERSION "${GRAPHVIZ_VERSION}")
50 ENDIF()
51
52 SET(GRAPHVIZ_DEFINITIONS)
53 IF("${GRAPHVIZ_VERSION}" VERSION_LESS "2.36.0")
54   SET(GRAPHVIZ_DEFINITIONS -DWITH_CGRAPH)
55 ENDIF()
56
57 ## Don't detect cgraph on Windows
58 #IF(NOT WIN32)
59 #  FIND_LIBRARY(GRAPHVIZ_cgraph_LIBRARY   NAMES cgraph PATH_SUFFIXES bin)
60 #  SET(GRAPHVIZ_LIBRARIES ${GRAPHVIZ_cgraph_LIBRARY})
61 #ENDIF()
62
63 # Handle the standard arguments of the find_package() command:
64 INCLUDE(FindPackageHandleStandardArgs)
65 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz REQUIRED_VARS 
66                                            GRAPHVIZ_EXECUTABLE 
67                                            GRAPHVIZ_LIBRARIES 
68                                            GRAPHVIZ_INCLUDE_DIRS)