Fontconfig debug build doesn't find debug version of libexpat (libexpatd.lib)
This was found in the context of gvsbuild (a Python script for building the GTK stack on Windows). The pertinent issue is https://github.com/wingtk/gvsbuild/issues/971.
gvsbuild currently builds version 2.14.2 of fontconfig and version 2.50.0 of expat.
Since at least expat version 2.2.9 back in 2019, the expat library names have been libexpat.lib for release builds and libexpatd.lib for debug builds.
The fontconfig build code that searches for expat apparently doesn't know to look for libexpatd.lib (with the "d" suffix) for the debug build configuration. Although libexpatd.lib does exist at build time, the fontconfig build doesn't find it. Instead, it falls back to building version 2.2.6 of expat as a subproject. Version 2.2.6 was before the expat library name change, so that version of expat produces "expat.lib".
On the other hand, the release configuration of the fontconfig build does find libexpat.lib and properly links to that library.
The result of this is that debug and release configurations of fontconfig refer to different versions of the expat library with different library names. This, in turn, leads to deployment issues for applications that are distributed with shared libraries. (For example, I ran into this problem while running an application that had been distributed with the gvsbuild-generated fontconfig-1.dll and libexpatd.dll, but the application failed to launch because expat.dll had not been distributed.)