Skip to content

Commit

Permalink
FindGraphviz: if available export version of the package from pkg-config
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Nov 27, 2023
1 parent 266a5a4 commit 4185f54
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions 3rdparty/qgv/FindGraphviz.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4185f54

Please sign in to comment.