Page MenuHomePhabricator

[llvm-config] Print --system-libs only when static linking

Authored by mgorny on Dec 15 2016, 6:38 AM.



Modify the --system-libs option in llvm-config to print system libs only
when using static linking. The system libraries are irrelevant when
linking to a shared library since the library has appropriate library
dependencies embedded.

Modify the --system-libs test appropriately to force static linking, and
disable it if static libs are not available (i.e. BUILD_SHARED_LIBS is

Diff Detail


Event Timeline

mgorny updated this revision to Diff 81573.Dec 15 2016, 6:38 AM
mgorny retitled this revision from to [llvm-config] Print --system-libs only when static linking.
mgorny updated this object.
mgorny added reviewers: chapuni, compnerd, ddunbar, beanz.
mgorny added a subscriber: llvm-commits.
compnerd added inline comments.Dec 15 2016, 8:12 AM
700 ↗(On Diff #81573)

The braces are unnecessary. You can probably even just use a ternary.

OS << (LinkMode == LinkModeShared ? "" : LLVM_SYSTEM_LIBS) << '\n';
mgorny added inline comments.Dec 15 2016, 8:41 AM
700 ↗(On Diff #81573)

Yeah, that makes sense.

mgorny updated this revision to Diff 81592.Dec 15 2016, 9:08 AM
mgorny marked 2 inline comments as done.

I've left the outer quotes because of the comment inside.


A gentle ping.

mgorny updated this revision to Diff 83350.Jan 6 2017, 12:53 AM

Rebased on top of the cmake->lit argument refactor.

compnerd accepted this revision.Jan 6 2017, 7:23 AM
compnerd edited edge metadata.

You can house the comment above the conditional and remove the braces.

This revision is now accepted and ready to land.Jan 6 2017, 7:23 AM
This revision was automatically updated to reflect the committed changes.