cutter/cmake/FindGraphviz.cmake

30 lines
971 B
CMake
Raw Permalink Normal View History

set (_module Graphviz)
2020-03-15 13:43:42 +00:00
find_package(PkgConfig)
if (PkgConfig_FOUND)
if (NOT (CMAKE_VERSION VERSION_LESS "3.12.0"))
pkg_check_modules(GVC IMPORTED_TARGET GLOBAL libgvc)
elseif (NOT (CMAKE_VERSION VERSION_LESS "3.11.0"))
pkg_check_modules(GVC IMPORTED_TARGET libgvc)
else()
pkg_check_modules(GVC libgvc)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(${_module}
FOUND_VAR ${_module}_FOUND
REQUIRED_VARS GVC_INCLUDE_DIRS)
if (${GVC_FOUND})
if (CMAKE_VERSION VERSION_LESS "3.11.0")
add_library(${_module}::GVC INTERFACE IMPORTED)
set_target_properties(${_module}::GVC PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GVC_INCLUDE_DIRS}")
set_target_properties(${_module}::GVC PROPERTIES
INTERFACE_LINK_LIBRARIES "${GVC_LIBRARIES}")
else()
add_library(${_module}::GVC ALIAS PkgConfig::GVC)
endif()
endif()