This is an archive of the discontinued LLVM Phabricator instance.

[Build] Use LIBXML2_LIBRARIES from find_package
AcceptedPublic

Authored by andrewrk on Mar 30 2018, 1:27 PM.

Details

Reviewers
ecbeckmann
labath
Summary

Previously we pass the string "xml2" to the link libraries of the WindowsManifest library. This prevents static linking against libxml2.

This patch fixes the build to follow the cmake convention of using the output of find_package as the LINK_LIBS argument.

Diff Detail

Repository
rL LLVM

Event Timeline

andrewrk created this revision.Mar 30 2018, 1:27 PM
ecbeckmann accepted this revision.Mar 30 2018, 2:31 PM
This revision is now accepted and ready to land.Mar 30 2018, 2:31 PM
labath added a comment.Apr 3 2018, 1:46 AM

I think you'll run into issues if you try to land this patch. I tried to do the same thing with zlib (see r319751 and related commits), but I had to roll it back because it broke things for a lot of people. Basically, the issue is we have code (e.g., llvm-config --system-libs) which assumes you can just paste "-l" in front of the system_libs libraries and get a valid linker line. This works only if system_libs is a list of bare lib names (and not a full file path).

I wish we had a better story for controlling the link behavior (I'm particularly interested in forcing static against a static library, when both static&dynamic libs are present), but right now I don't see how we could achieve that (without a big refactor).

labath added a comment.Apr 3 2018, 1:53 AM

Hmm... I see now that you add this only to the library list of the WindowsManifest module. I this case you might be able to get away with it because it will not make it's way into the llvm-config --system-libs output. However, this may actually be a sign of a bigger problem, as that may mean that things (external projects, mostly) which link against this library will not get the complete link command.

labath resigned from this revision.Aug 9 2019, 2:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2019, 2:06 AM