This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Export the LLVM_LINK_LLVM_DYLIB setting
ClosedPublic

Authored by philip.pfaffe on Jul 11 2018, 8:56 AM.

Details

Summary

When building out-of-tree tools, there are several macros available to
automate linking against llvm. An examples is add_llvm_executable, or
the clang variant of this.

These macros use the LLVM_LINK_LLVM_DYLIB option to decide whether to
link against libraries defined by setting LLVM_LINK_COMPONENTS or to
link against libLLVM instead. Currently this is problematic in
out-of-tree targets, because they cannot identify whether this option is
required or even available. If the option was enabled in LLVM's own
build, the clang libraries are built against libLLVM, so a client
linking against those must link against it too. On the other hand the
client can't just always link against it, because it might not be
available.

This is related to D44391, but that change assumed the client knew
whether they wanted the dylib or not.

Diff Detail

Repository
rL LLVM

Event Timeline

philip.pfaffe created this revision.Jul 11 2018, 8:56 AM

This looks straight-forward enough to me, though I would feel more comfortable if someone else (@mgorny ?) took a look at this too, to make sure I am not missing anything.

mgorny accepted this revision.Jul 17 2018, 10:24 AM

I don't think this could break anything. I presume you've tested it though.

This revision is now accepted and ready to land.Jul 17 2018, 10:24 AM
This revision was automatically updated to reflect the committed changes.