This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Add support for explicit STATIC libraries even when building mostly shared libraries.
AbandonedPublic

Authored by stephenneuendorffer on Oct 25 2019, 11:17 AM.

Details

Reviewers
chandlerc
beanz
Summary

By default when BUILD_SHARED_LIBS=ON, all libraries are forced to be
shared. However, with circular dependencies between libraries this
becomes a problem. This change allows libraries to be explicitly
marked as static in CMAKE to solve circular dependencies while getting
most of the build-time advantages from BUILD_SHARED_LIBS=ON

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2019, 11:17 AM

Are there currently libraries in tree which have circular dependencies?

@tstellar: Not that I know of, but MLIR has some circular dependencies and I've used this to solve them. This should be NFC for existing usage.

Now that MLIR is in tree, are there any specific objections to accepting this patch? We intend to eliminate the circular library dependence as well, however, there seems to be little reason to disallow this usage, as far as I can see.

We solved this in MLIR by breaking the circular dependence.