]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Detect version of graphviz, to set preprocessor definitions properly; for backward... omu/graphviz238
authorvsr <vsr@opencascade.com>
Fri, 10 Oct 2014 06:15:43 +0000 (10:15 +0400)
committervsr <vsr@opencascade.com>
Fri, 10 Oct 2014 06:15:43 +0000 (10:15 +0400)
salome_adm/cmake_files/FindGraphviz.cmake

index bc652bc8a3ca556776ecfcbc6886c644b08c9a30..5457f7a66fbc3c602d9d94aa7ddd930f1b9f42ef 100644 (file)
@@ -3,7 +3,9 @@
 # Output variables: GRAPHVIZ_EXECUTABLE   - where is executable 'dot' takes place.
 #                  GRAPHVIZ_INCLUDE_DIRS - where to find headers.
 #                  GRAPHVIZ_LIBRARIES    - where to get libraries.
-#                  GRAPHVIZ_FOUND        - True if Graphiz was found.
+#                  GRAPHVIZ_VERSION      - Graphviz version
+#                  GRAPHVIZ_DEFINITIONS  - Graphviz definitions
+#                  GRAPHVIZ_FOUND        - True if Graphviz was found.
 #
 ###########################################################################
 # Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
@@ -45,6 +47,16 @@ SET(GRAPHVIZ_LIBRARIES
   ${GRAPHVIZ_pathplan_LIBRARY}
   )
 
+IF(GRAPHVIZ_EXECUTABLE)
+  EXECUTE_PROCESS(COMMAND ${GRAPHVIZ_EXECUTABLE} "-V" ERROR_VARIABLE GRAPHVIZ_VERSION ERROR_STRIP_TRAILING_WHITESPACE)
+  STRING(REGEX REPLACE ".* ([0-9.]+) .*" "\\1" GRAPHVIZ_VERSION "${GRAPHVIZ_VERSION}")
+ENDIF()
+
+SET(GRAPHVIZ_DEFINITIONS)
+IF("${GRAPHVIZ_VERSION}" VERSION_LESS "2.36.0")
+  SET(GRAPHVIZ_DEFINITIONS -DWITH_CGRAPH)
+ENDIF()
+
 ## Don't detect cgraph on Windows
 #IF(NOT WIN32)
 #  FIND_LIBRARY(GRAPHVIZ_cgraph_LIBRARY   NAMES cgraph PATH_SUFFIXES bin)