[PATCH] Document new LLVM CMake interface and emit warning when using llvm_map_components_to_libraries

Dan Liew dan at su-root.co.uk
Wed Jul 23 12:18:52 PDT 2014


On 23 July 2014 18:06, Brad King <brad.king at kitware.com> wrote:
> On 07/23/2014 12:50 PM, Dan Liew wrote:
>> Given that now all the client of LLVM sees is a different function
>> name wouldn't it make more sense for the implementation of
>> llvm_map_components_to_libraries() to just call
>> llvm_map_components_to_libnames()? They seem to have the same
>> signature and doing that would mean that current users of LLVM using
>> CMake don't have to change their own CMakeLists.txt files.
>
> I'm not opposed to your proposal myself but here is some history:
>
> Takumi factored llvm_map_components_to_libnames out from the original
> llvm_map_components_to_libraries in r200764 to provide an interface
> for the "new" behavior while preserving the "old" behavior in the
> original interface.  Some projects may be doing something with the
> results besides passing to target_link_libraries.  I think a
> deprecation warning is the only way to find out about such projects
> without breaking them.

Okay.

@Takumi - Are you happy with the status quo of

- Deprecated llvm_map_components_to_libraries()
- Recommending users user llvm_map_component_to_libnames() instead

?

>> +directory (e.g. by passing ``-DLLVM_DIR:STRING=/usr/share/llvm/cmake/`` to
>
> Use the type PATH rather than STRING so cmake-gui will use a
> file-chooser dialog to edit the value interactively.  Or you
> can just leave off the type: ``-DLLVM_DIR=/usr/share/llvm/cmake/``
> and the find_package command should set the type for you.

Hmm I don't usually pass variables to cmake-gui . When I do this it
behaves incredibly weirdly

$ mkdir build
$ cd build
$ cmake-gui -DLLVM_DIR=/home/dan/dev/llvm-upstream/build/share/llvm/cmake
~/dev/llvm-pass-tutorial/src

It then shows a window with

Where is the source code "/home/dan/dev/llvm-upstream/src"
Where to build the binaries "/home/dan/dev/llvm-upstream/build"

This is showing my recent CMake configuration of LLVM and not for the
project with source at "~/dev/llvm-pass-tutorial/src" . I can even do
this...

$ cmake-gui -DFOO=bar ~/dev/llvm-pass-tutorial/src

and the same thing happens. The --help doesn't mention cmake-gui
supporting -D flags so I guess it just shows the last thing you
configured if you give it a bad path like "-DFOO=bar".

This is why in the guide I only mention passing this for the ``cmake``
command (although the ccmake command seems to support -D).

I've change the docs to use ``-DLLVM_DIR=``

I presume the attached patches are okay to commit once I've heard back
from Takumi?

Thanks,
Dan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Document-the-new-LLVM-CMake-interface-for-building-a.patch
Type: text/x-patch
Size: 8114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140723/7ff2f53d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Emit-a-warning-if-llvm_map_components_to_libraries-n.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140723/7ff2f53d/attachment-0001.bin>


More information about the llvm-commits mailing list