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