llvm.org GIT mirror llvm / 07a4ec0
llvm-config: fix --libs on Linux Summary: llvm-config --libs does not produce correct output since commit r260263 (llvm-config: Add preliminary Windows support) changed naming format of the libraries. This patch updates llvm-config to recognize new naming format and output correct linker flags. Ref: https://llvm.org/bugs/show_bug.cgi?id=26581 Patch by Vedran Miletić Reviewers: ehsan, rnk, pxli168 Subscribers: pxli168 Differential Revision: http://reviews.llvm.org/D17300 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263497 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 3 years ago
1 changed file(s) with 9 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
644644 } else if (PrintLibFiles) {
645645 OS << GetComponentLibraryPath(Lib, Shared);
646646 } else if (PrintLibs) {
647 // If this is a typical library name, include it using -l.
648 StringRef LibName;
649 if (Lib.startswith("lib")) {
647 // On Windows, output full path to library without parameters.
648 // Elsewhere, if this is a typical library name, include it using -l.
649 if (HostTriple.isWindowsMSVCEnvironment()) {
650 OS << GetComponentLibraryPath(Lib, Shared);
651 } else {
652 StringRef LibName;
650653 if (GetComponentLibraryNameSlice(Lib, LibName)) {
654 // Extract library name (remove prefix and suffix).
651655 OS << "-l" << LibName;
652656 } else {
653 OS << "-l:" << GetComponentLibraryFileName(Lib, Shared);
657 // Lib is already a library name without prefix and suffix.
658 OS << "-l" << Lib;
654659 }
655 } else {
656 // Otherwise, print the full path.
657 OS << GetComponentLibraryPath(Lib, Shared);
658660 }
659661 }
660662 };