This is an archive of the discontinued LLVM Phabricator instance.

[cmake] fix a typo in llvm_config macro
ClosedPublic

Authored by labath on Mar 13 2018, 4:53 AM.

Details

Summary

The macro parses out the USE_SHARED option out of the argument list, but
then ignores it and accesses the variable with the same name instead. It
seems the intention here was to check the argument value.

Technically, this is NFC, because the only in-tree usage
(add_llvm_executable) of USE_SHARED sets both the variable and the
argument when calling llvm_config, but it makes the usage of this macro
for out-of-tree users more sensible.

Diff Detail

Event Timeline

labath created this revision.Mar 13 2018, 4:53 AM

+1 from me; it fixes llvm_config(foo USE_SHARED ...) for out-of-tree builds.

foutrelis added a subscriber: foutrelis.
mgorny accepted this revision.Jun 5 2018, 11:53 PM

Good catch! LGTM.

That said, I wonder if this works with split shared libraries. But if not, that's a separate bug to address, so shouldn't really block this.

This revision is now accepted and ready to land.Jun 5 2018, 11:53 PM
This revision was automatically updated to reflect the committed changes.
labath added a comment.Jun 6 2018, 3:14 AM

Good catch! LGTM.

That said, I wonder if this works with split shared libraries. But if not, that's a separate bug to address, so shouldn't really block this.

IIRC, I too got the impression that this wasn't doing the right thing for BUILD_SHARED_LIBS, though I don't remember what was the reason.