robotology / ycm-cmake-modules

YCM (YCM CMake modules) is a collection of various useful CMake modules.
http://robotology.github.io/ycm-cmake-modules
Other
50 stars 22 forks source link

FindGraphviz: Add Graphviz_DEFINITIONS to define GVDLL and release 0.14.2 #414

Closed traversaro closed 2 years ago

traversaro commented 2 years ago

Since graphviz 3, any downstream library that on Windows links against a graphviz shared library needs to define the GVDLL preprocessor definition (see https://gitlab.com/graphviz/graphviz/-/blob/3.0.0/CHANGELOG.md#changed).

To deal with this, this PR adds the Graphviz_DEFINITIONS output variable to the FindGraphviz module, and populates with GVDLL when on Windows (on graphviz < 3 defining this definition will be harmless). As that prepocessor definition should not be set when linking static graphviz, and given that we can't detect in FindGraphviz if the linked graphviz is static or not, an ad-hoc CMake variable YCM_FINDGRAPHVIZ_USE_STATIC_GRAPHVIZ is introduced in the case this definition needs to be disabled.

Partial fix for https://github.com/robotology/robotology-superbuild/pull/1166 and https://github.com/robotology/robotology-superbuild/issues/1152 .