[PATCH] D11835: Make `llvm-config` work when static versions of LLVM's components aren't installed.
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 16:40:14 PDT 2015
delcypher added inline comments.
================
Comment at: tools/llvm-config/llvm-config.cpp:380
@@ +379,3 @@
+ // documented nonetheless.
+ const bool BuiltWithSharedLib = (std::strcmp(BUILD_SHARED_LIBS, "ON") == 0);
+ std::string SharedLibName = "libLLVM-" PACKAGE_VERSION;
----------------
DiamondLovesYou wrote:
> brad.king wrote:
> > When building with CMake the value of `BUILD_SHARED_LIBS` may have "true" values other than `ON`. The value could be configured in the header file with
> >
> > #cmakedefine BUILD_SHARED_LIBS
> >
> > and then the logic here can just use `#ifdef`. Or, one could configure another variable that is known to be set as desired:
> >
> > if(BUILD_SHARED_LIBS)
> > set(LLVM_ENABLE_SHARED ON)
> > else()
> > set(LLVM_ENABLE_SHARED OFF)
> > endif()
> >
> >
> But doesn't CMake build separate shared libraries for each component? Meaning `libLLVM-3.7.0svn.so` wouldn't exist, meaning `llvm-config` would still use the old behavior? Please correct me if I'm wrong.
> But doesn't CMake build separate shared libraries for each component
Yes and No. It's complicated if you use BUILD_SHARED_LIBS then think the answer is yes but I don't think that's how it is intended for LLVM to ship and I never build that way.
Chris Bieneman, implemented support for building a single shared library (see LLVM_BUILD_LLVM_DYLIB option). What complicates matters more is that the shared library can have all C++ symbols hidden (see LLVM_DYLIB_EXPORT_ALL) and the components inside the library can be customised using LLVM_DYLIB_COMPONENTS (this currently isn't a CMake cache variable and it probably should be!). The end result of this is just because you have a single shared library it doesn't necessarily mean that all the components are available.
http://reviews.llvm.org/D11835
More information about the llvm-commits
mailing list