- // 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);
- const bool WasBuiltWithCMake = (std::strcmp(WAS_BUILT_WITH_CMAKE, "ON") == 0);
- // CMake correctly builds components as separate shared libraries, however
- // autoconfig/make builds components a static libraries and then links
- // them all together to form a single shared library. Thus, only when
- // `WAS_BUILT_WITH_CMAKE` is `OFF` and `BUILD_SHARED_LIBS` is `ON` do we
- // override `RequiredLibs` with the single library name.
- if (IsSharedLib && !WasBuiltWithCMake) {
- RequiredLibs.clear();
- std::string Name = "libLLVM-" PACKAGE_VERSION;
- const Triple HostTriple(LLVM_DEFAULT_TARGET_TRIPLE);
- if (HostTriple.isOSWindows()) {
- Name += ".dll";
- } else if (HostTriple.isOSDarwin()) {
- Name += ".dylib";
- } else {
- // default to linux' ext:
- Name += ".so";
- }
- RequiredLibs.push_back(Name);
- }
-