cmake: Simplify and improve FindGraphviz.cmake

Authored by rakuco on Jul 15 2018, 9:44 PM.



Remove a lot of cruft, and move detection of dot(1) to a separate
FindDOT.cmake. More specifically:

  • Read Graphviz's version from a header file instead of invoking dot during configuration. dot should only be needed at runtime. Doing so allows us to significantly trim down FindGraphviz.cmake.
  • State that Graphviz 2.30 is the minimum version we support in CMakeLists.txt, so that FindGraphviz.cmake remains more generic.
  • Always try to invoke pkg-config in FindGraphviz.cmake, there is no need to avoid it on Windows, we just don't use its output if it is not present.
  • Remove a bunch of hardcoded locations from find_library(), let CMake handle those automatically and just provide pkg-config's output as HINTS.
  • Create a FindDOT.cmake that looks for dot, and lists it as a runtime dependency in CMake's summary.
Test Plan

Everything still worked fine.

Diff Detail

R491 KGraphViewer
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
rakuco requested review of this revision.Jul 15 2018, 9:44 PM
rakuco created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.May 31 2020, 11:49 AM
This revision was automatically updated to reflect the committed changes.

@adridg Seems KDE CI has issues getting this to build with FreeBSD (eek, what irony given the persons involved in this patch :) ). Please have a look:

adridg added a comment.Jun 6 2020, 2:23 PM

It would be ironic, if the problem was in the find-module, and not in the CMakeLists.txt of kgraphviewer itself, which in some places uses ${graphviz_LIBRARIES} and elsewhere does not. I'll just push a fix to invent.