Warning, /graphics/kgraphviewer/cmake/FindGraphviz.cmake is written in an unsupported language. File is not indexed.
0001 # This cmake file comes from MOAB:
0002 # MOAB, a Mesh-Oriented datABase, is a software component for creating,
0003 # storing and accessing finite element mesh data.
0004 #
0005 # Copyright 2004 Sandia Corporation. Under the terms of Contract
0006 # DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
0007 # retains certain rights in this software.
0008 #
0009 # This library is free software; you can redistribute it and/or
0010 # modify it under the terms of the GNU Lesser General Public
0011 # License as published by the Free Software Foundation; either
0012 # version 2.1 of the License, or (at your option) any later version.
0013 #
0014 # This library is distributed in the hope that it will be useful,
0015 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0017 # Lesser General Public License for more details. A copy of the full
0018 # GNU Lesser General Public License can be found at
0019 # http://www.gnu.org/copyleft/lesser.html.
0020 #
0021 # For more information, contact the authors of this software at
0022 # moab@sandia.gov.
0023 #
0024 # Find Graphviz libraries. This will set the following variables:
0025 # Graphviz_LIBRARIES
0026 # Graphviz_FOUND
0027 # Graphviz_INCLUDE_DIRECTORIES
0028 # Graphviz_VERSION
0029
0030 find_package(PkgConfig)
0031 pkg_check_modules(pc_graphviz ${REQUIRED} libgvc libcdt libcgraph libpathplan)
0032
0033 find_path(Graphviz_INCLUDE_DIRECTORIES
0034 NAMES gvc.h
0035 HINTS ${pc_graphviz_INCLUDEDIR}
0036 ${pc_graphviz_INCLUDE_DIRS}
0037 )
0038
0039 find_library(Graphviz_GVC_LIBRARY
0040 NAMES gvc
0041 HINTS ${pc_graphviz_LIBDIR}
0042 ${pc_graphviz_LIBRARY_DIRS}
0043 )
0044
0045 find_library(Graphviz_CDT_LIBRARY
0046 NAMES cdt
0047 HINTS ${pc_graphviz_LIBDIR}
0048 ${pc_graphviz_LIBRARY_DIRS}
0049 )
0050
0051 find_library(Graphviz_GRAPH_LIBRARY
0052 NAMES cgraph
0053 HINTS ${pc_graphviz_LIBDIR}
0054 ${pc_graphviz_LIBRARY_DIRS}
0055 )
0056
0057 find_library(Graphviz_PATHPLAN_LIBRARY
0058 NAMES pathplan
0059 HINTS ${pc_graphviz_LIBDIR}
0060 ${pc_graphviz_LIBRARY_DIRS}
0061 )
0062
0063 set(Graphviz_LIBRARIES
0064 "${Graphviz_GVC_LIBRARY}" "${Graphviz_CDT_LIBRARY}"
0065 "${Graphviz_GRAPH_LIBRARY}" "${Graphviz_PATHPLAN_LIBRARY}")
0066
0067 if (EXISTS "${Graphviz_INCLUDE_DIRECTORIES}/graphviz_version.h")
0068 file(READ "${Graphviz_INCLUDE_DIRECTORIES}/graphviz_version.h" _graphviz_version_content)
0069 string(REGEX MATCH "#define +PACKAGE_VERSION +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_graphviz_version_content}")
0070 set(Graphviz_VERSION "${CMAKE_MATCH_1}")
0071 endif ()
0072
0073 if ("${Graphviz_FIND_VERSION}" VERSION_GREATER "${Graphviz_VERSION}")
0074 message(FATAL_ERROR "Required version (" ${Graphviz_FIND_VERSION} ") is higher than found version (" ${Graphviz_VERSION} ")")
0075 endif ()
0076
0077 include(FindPackageHandleStandardArgs)
0078 find_package_handle_standard_args(Graphviz
0079 REQUIRED_VARS Graphviz_LIBRARIES Graphviz_INCLUDE_DIRECTORIES
0080 VERSION_VAR Graphviz_VERSION)
0081
0082 if(Graphviz_FOUND AND NOT TARGET Graphviz::Graphviz)
0083 add_library(Graphviz::Graphviz UNKNOWN IMPORTED)
0084 set_target_properties(Graphviz::Graphviz PROPERTIES
0085 IMPORTED_LOCATION "${Graphviz_GVC_LIBRARY}" # randomly picked, should this be another one?
0086 INTERFACE_LINK_LIBRARIES "${Graphviz_CDT_LIBRARY};${Graphviz_GRAPH_LIBRARY};${Graphviz_PATHPLAN_LIBRARY}"
0087 INTERFACE_INCLUDE_DIRECTORIES "${Graphviz_INCLUDE_DIRECTORIES}"
0088 )
0089 endif()