This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add LIBXML2_DEFINITIONS when testing for symbol existance
ClosedPublic

Authored by zero9178 on Jul 24 2021, 12:26 AM.

Details

Summary

Currently when linking LLVM against Libxml2, a simple check is performed to check whether it can be linked successfully. This check currently adds the include directories and the libraries for libxml2, but not definitions found by the config.

This causes issues on Windows when trying to link against a static libxml2. Libxml2 requires LIBXML_STATIC to be defined in the preprocessor to be able to link statically. This definition is put into LIBXML2_DEFINITIONS in the cmake config, but not properly forwarded to check_symbol_exists leading to it failing as it could not find xmlReadMemory in a DLL.

This patch simply appends the content of LIBXML2_DEFINITIONS to the symbol check definitions, fixing the issue.

Diff Detail

Event Timeline

zero9178 created this revision.Jul 24 2021, 12:26 AM
zero9178 requested review of this revision.Jul 24 2021, 12:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2021, 12:26 AM
phosek accepted this revision.Jul 24 2021, 12:52 AM

LGTM

This revision is now accepted and ready to land.Jul 24 2021, 12:52 AM
This revision was landed with ongoing or failed builds.Jul 24 2021, 12:55 AM
This revision was automatically updated to reflect the committed changes.