[llvm] r263497 - llvm-config: fix --libs on Linux
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 14 14:39:59 PDT 2016
Author: rnk
Date: Mon Mar 14 16:39:58 2016
New Revision: 263497
URL: http://llvm.org/viewvc/llvm-project?rev=263497&view=rev
Log:
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
Modified:
llvm/trunk/tools/llvm-config/llvm-config.cpp
Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=263497&r1=263496&r2=263497&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Mon Mar 14 16:39:58 2016
@@ -645,17 +645,19 @@ int main(int argc, char **argv) {
} else if (PrintLibFiles) {
OS << GetComponentLibraryPath(Lib, Shared);
} else if (PrintLibs) {
- // If this is a typical library name, include it using -l.
- StringRef LibName;
- if (Lib.startswith("lib")) {
+ // On Windows, output full path to library without parameters.
+ // Elsewhere, if this is a typical library name, include it using -l.
+ if (HostTriple.isWindowsMSVCEnvironment()) {
+ OS << GetComponentLibraryPath(Lib, Shared);
+ } else {
+ StringRef LibName;
if (GetComponentLibraryNameSlice(Lib, LibName)) {
+ // Extract library name (remove prefix and suffix).
OS << "-l" << LibName;
} else {
- OS << "-l:" << GetComponentLibraryFileName(Lib, Shared);
+ // Lib is already a library name without prefix and suffix.
+ OS << "-l" << Lib;
}
- } else {
- // Otherwise, print the full path.
- OS << GetComponentLibraryPath(Lib, Shared);
}
}
};
More information about the llvm-commits
mailing list