[cmake-developers] Question / Feature request: LLVM bitcode target

Stanislav Pankevich s.pankevich at gmail.com
Mon Jan 16 15:49:53 EST 2017


Hello,

This goes somewhere between a question and a feature request.

We are working on mull, https://github.com/mull-project/mull mutation
testing
system based on top of LLVM. Currently the development is mostly focused
around
testing of C++ projects and we use LLVM and its libraries as a playground.

To run Mull against a library like LLVMCore or
LLVMSupport, we need to compile the library, its tests and all of
its dependencies to LLVM bitcode.

Currently the best thing we can do to achieve this so far is to get a
compilation database for a target and all of its dependencies using ninja
and
do some bash magic to patch the `clang ...` commands to
produce a suite of *.bc files which Mull can then consume.

We think that it would be great if CMake had a capability of generating
LLVM bitcode targets out of existing targets with a support of incremental
compilation so that one could iterate on development of a library
and this kind of bitcode target would produce a set of *.bc files in a same
way like
add_library produces libraries.

I have tried to clone the targets by hand using this script as a starting
point:
https://github.com/shadow/shadow/blob/master/cmake/LLVMTools.cmake#L40 but
found
that it was hard to create a clone of existing target to 100% match all of
the
compilation options of a source target. I could make it work for some of the
LLVM targets but overall this approach seems to not be a solid one.

So the following are questions that taken together might constitute a
feature request:

- Can it be possible to recursively clone existing library target created
with
add_library and all of its dependencies?
- Modify this cloned target to produce a set of *.bc files instead of a
binary.
- Have this routine wrapped into a stable and portable CMake function like:
add_llvm_bitcode_target?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20170116/b74de653/attachment-0001.html>


More information about the cmake-developers mailing list