diff --git a/3rdparty/qgv/FindGraphviz.cmake b/3rdparty/qgv/FindGraphviz.cmake index 52901a48..a3d00e5b 100644 --- a/3rdparty/qgv/FindGraphviz.cmake +++ b/3rdparty/qgv/FindGraphviz.cmake @@ -5,6 +5,10 @@ # Graphviz_LIBRARIES # Graphviz_INCLUDE_DIRS # Graphviz_DEFINITIONS +# +# If pkg-config and .pc files for graphviz are found, +# it will also define: +# Graphviz_VERSION if(EXISTS "$ENV{Graphviz_ROOT}") set(Graphviz_POSSIBLE_INCDIRS @@ -44,8 +48,8 @@ endif() # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls -if(NOT WIN32) - find_package(PkgConfig) +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) pkg_check_modules(Graphviz_GVC_PKG gvc QUIET) pkg_check_modules(Graphviz_CGRAPH_PKG cgraph QUIET) pkg_check_modules(Graphviz_CDT_PKG cdt QUIET) @@ -108,6 +112,11 @@ if(WIN32) endif() endif() +if( (Graphviz_GVC_PKG_VERSION VERSION_EQUAL Graphviz_CGRAPH_PKG_VERSION) AND + (Graphviz_GVC_PKG_VERSION VERSION_EQUAL Graphviz_CDT_PKG_VERSION) ) + set(Graphviz_VERSION ${Graphviz_GVC_PKG_VERSION}) +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Graphviz FOUND_VAR Graphviz_FOUND