[LLVMdev] Fixing LLVM's CMake interface before LLVM3.5 release

Brad King brad.king at kitware.com
Thu Jul 17 06:22:35 PDT 2014


On 07/16/2014 07:48 PM, Dan Liew wrote:
> I've been playing [1] with the newly introduced CMake interface for
> using exported LLVM CMake targets (e.g. the LLVMSupport library) in
> CMake projects

Thanks for trying it out.

> at some point remove the llvm_map_components_to_libraries() stuff

I agree it should be removed eventually but I'll defer to others on
when and how.

> I am happy to start writing a patch for the documentation

Thanks.  Please Cc me for review.

> # LLVM_BUILD_* values available only from LLVM build tree.

Those were created to simplify building Clang locally against a
LLVM build tree.  Clang needs the LLVM source and build trees too,
so this gives it that information.  No information is missing from
the install-tree interface about what is actually installed, AFAIK.

> In [1] I hacked around this by reading the ``LOCATION`` property of
> one of the imported targets. Unfortunately CMake 3.0 really doesn't
> like this I get warnings

As suggested in the CMP0026 documentation:

 http://www.cmake.org/cmake/help/v3.0/policy/CMP0026.html

you can use the $<TARGET_FILE:SomeTool> generator expression to
get the location in a well-defined manner.  It works in
add_custom_command so that should be sufficient for your example
use case.

> 4. Why don't we expose any of the CXXFLAGS in the CMake interface?
> 
> To use LLVM libraries as a client at minimum ``-std=c++11 -f-no-rtti``
> are needed. This information is shown by the ``llvm-config
> --cxxflags`` command but why aren't we exposing this information in
> LLVMConfig.cmake so clients can make use of it.

That was an oversight.  If you want to add them, they could go in
a variable named something like "LLVM_REQUIRED_CXX_FLAGS".  Note
that this content will need to be populated by both build systems:

 cmake/modules/CMakeLists.txt
 cmake/modules/Makefile

Thanks,
-Brad




More information about the llvm-dev mailing list