The gdlib-config program is no longer installed with the newer versions
of the library as it is deprecated. The CMake build on CI for Fedora
prints the following, which is no longer the case with this patch:
CMake Warning at cmake/FindGD.cmake:63 (message):
gdlib-config not found; skipping feature checks
Call Stack (most recent call first):
contrib/diffimg/CMakeLists.txt:1 (find_package)
xref: https://github.com/libgd/libgd/issues/376#issuecomment-
276138975
Edits from Matthew Fernandez:
- Wrap CMake line
- Adjust #1786 work arounds
Gitlab: #1786
assert which(tool) is None, f"{tool} has been resurrected in the " \
f'{os.getenv("build_system")} build on {os_id}. Please remove skip.'
-@pytest.mark.xfail(is_cmake() and not is_centos()
- and not platform.system() == "Darwin",
+@pytest.mark.xfail(is_cmake() and platform.system() == "Windows"
+ and not is_mingw(),
reason="png:gd unavailable when built with CMake",
strict=True) # FIXME
def test_1786():
set(GD_LIBRARIES ${GD_LIBRARY})
set(GD_RUNTIME_LIBRARIES ${GD_RUNTIME_LIBRARY})
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+ pkg_check_modules(GDLIB gdlib>=2.0.33)
+endif()
+
if(GD_LIBRARY)
find_program(GDLIB_CONFIG gdlib-config)
if(GDLIB_CONFIG)
set(HAVE_GD_GIF 1)
endif()
else()
- if(APPLE)
+ if(APPLE OR GDLIB_FOUND)
# At time of writing, Macports does not package libgd. So assume the user
# obtained this through Homebrew and hard code the options the Homebrew
# package enables.
set(HAVE_GD_FREETYPE 1)
set(HAVE_GD_GIF 1)
else()
- message(WARNING "gdlib-config not found; skipping feature checks")
+ message(
+ WARNING
+ "gdlib-config/gdlib pkgconfig not found; skipping feature checks")
endif()
endif()
endif()