Chromium Code Reviews| Index: tools/llvm-config/llvm-config.cpp |
| diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp |
| index 879b9ab0945ba64235584f2d1e2652bff8bc7c23..b04048a8bf1e05302390c1e40f9ef0b4da5ce386 100644 |
| --- a/tools/llvm-config/llvm-config.cpp |
| +++ b/tools/llvm-config/llvm-config.cpp |
| @@ -349,6 +349,14 @@ int main(int argc, char **argv) { |
| /*IncludeNonInstalled=*/IsInDevelopmentTree); |
| if (PrintLibs || PrintLibNames || PrintLibFiles) { |
| + // If LLVM was built as a shared library, there will be only one thing |
| + // that users should link against. |
| + const bool IsSharedLib = (std::strcmp(BUILD_SHARED_LIBS, "ON") == 0); |
|
JF
2015/06/24 21:09:01
Could you change BUILD_SHARED_LIBS's name? There's
Richard Diamond
2015/06/24 21:44:30
`BUILD_SHARED_LIBS` is the CMake var name. Or did
JF
2015/06/24 21:52:42
If it's named the same as cmake's but doesn't have
Richard Diamond
2015/06/24 21:54:48
Setting `BUILD_SHARED_LIBS` to `ON` tells LLVM to
|
| + if (IsSharedLib) { |
| + RequiredLibs.clear(); |
| + RequiredLibs.push_back("libLLVM-" PACKAGE_VERSION ".so"); |
|
JF
2015/06/24 21:09:01
Here and on line 375 you hard-code ".so". That see
|
| + } |
| + |
| for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) { |
| StringRef Lib = RequiredLibs[i]; |
| if (i) |
| @@ -360,9 +368,14 @@ int main(int argc, char **argv) { |
| OS << ActiveLibDir << '/' << Lib; |
| } else if (PrintLibs) { |
| // If this is a typical library name, include it using -l. |
| - if (Lib.startswith("lib") && Lib.endswith(".a")) { |
| - OS << "-l" << Lib.slice(3, Lib.size()-2); |
| - continue; |
| + if (Lib.startswith("lib")) { |
| + if (Lib.endswith(".a")) { |
| + OS << "-l" << Lib.slice(3, Lib.size() - 2); |
| + continue; |
| + } else if (Lib.endswith(".so")) { |
|
JF
2015/06/24 21:09:01
Here too.
|
| + OS << "-l" << Lib.slice(3, Lib.size() - 3); |
| + continue; |
| + } |
| } |
| // Otherwise, print the full path. |