From: Matthew Fernandez Date: Sun, 13 Sep 2020 22:05:28 +0000 (-0700) Subject: fix failure to find Cairo, PangoCairo under CMake < 3.12 X-Git-Tag: 2.46.0~20^2^2~83^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b14ac3c0734fc493eb2247b915eae9aff26ca703;p=graphviz fix failure to find Cairo, PangoCairo under CMake < 3.12 The changes introduced in 3ecf2f6206a486fecdea870b7f29ea539345642a and b4f998c133566ef9cb416c085d1ce49e539bec30 were accidentally assuming the behavior of PkgConfig that is only true after CMake 3.12. Namely that it sets the *_LINK_LIBRARIES variable for packages it discovers. Closes #1824. --- diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index bd5149472..0cc48eff2 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -37,6 +37,12 @@ else() find_package(PkgConfig) pkg_check_modules(Cairo cairo) + # prior to CMake 3.12, PkgConfig does not set *_LINK_LIBRARIES, so do it + # manually + if (${CMAKE_VERSION} VERSION_LESS 3.12) + find_library(Cairo_LINK_LIBRARIES cairo PATHS ENV LIBRARY_PATH) + endif() + find_package_handle_standard_args(Cairo DEFAULT_MSG Cairo_INCLUDE_DIRS Cairo_LIBRARIES diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake index d1e3fee9f..7e9d3b362 100644 --- a/cmake/FindPangoCairo.cmake +++ b/cmake/FindPangoCairo.cmake @@ -70,6 +70,13 @@ else() find_package(PkgConfig) pkg_check_modules(PangoCairo pangocairo) + # prior to CMake 3.12, PkgConfig does not set *_LINK_LIBRARIES, so do it + # manually + if (${CMAKE_VERSION} VERSION_LESS 3.12) + find_library(PangoCairo_LINK_LIBRARIES pangocairo-1.0 + PATHS ENV LIBRARY_PATH) + endif() + find_package_handle_standard_args(PangoCairo DEFAULT_MSG PangoCairo_INCLUDE_DIRS PangoCairo_LIBRARIES