FindEXPAT: Fix for debug and other modified builds
Currently, FindEXPAT only looks for libexpat
and expat
when looking for the library. This is a problem as there are various modifications that might be made to the library name based on cmake settings used while the library was built:
https://github.com/libexpat/libexpat/blob/0a69634eb45e4c169f9c85b03954f26eca61f49b/expat/CMakeLists.txt#L406-L437
If libexpat was built with any of these modifications, FindEXPAT reports that it could not find the library.
It would be nice to have all these various library builds covered, like is already done in FindZLIB: https://gitlab.kitware.com/cmake/cmake/-/blob/548484e634d8e393fb7e53f309ab5980b8ce3483/Modules/FindZLIB.cmake#L112-L118
It is possible to configure this manually using CMAKE_FIND_LIBRARY_SUFFIXES. However, this value is overridden when project()
is called, so if that comes before find_program()
then setting this option via the CLI has no effect. This makes it difficult to work with external projects with this dependency.