<div dir="ltr">Hello,<br><br>This goes somewhere between a question and a feature request.<br><br>We are working on mull, <a href="https://github.com/mull-project/mull">https://github.com/mull-project/mull</a> mutation testing<br>system based on top of LLVM. Currently the development is mostly focused around<br>testing of C++ projects and we use LLVM and its libraries as a playground. <br><br>To run Mull against a library like LLVMCore or<br>LLVMSupport, we need to compile the library, its tests and all of<br>its dependencies to LLVM bitcode.<br><br>Currently the best thing we can do to achieve this so far is to get a<br>compilation database for a target and all of its dependencies using ninja and<br>do some bash magic to patch the `clang ...` commands to<br>produce a suite of *.bc files which Mull can then consume.<br><br>We think that it would be great if CMake had a capability of generating<br>LLVM bitcode targets out of existing targets with a support of incremental<br>compilation so that one could iterate on development of a library<br>and this kind of bitcode target would produce a set of *.bc files in a same way like<br>add_library produces libraries.<br><br>I have tried to clone the targets by hand using this script as a starting point:<br><a href="https://github.com/shadow/shadow/blob/master/cmake/LLVMTools.cmake#L40">https://github.com/shadow/shadow/blob/master/cmake/LLVMTools.cmake#L40</a> but found<br>that it was hard to create a clone of existing target to 100% match all of the<br>compilation options of a source target. I could make it work for some of the<br>LLVM targets but overall this approach seems to not be a solid one.<br><br>So the following are questions that taken together might constitute a<br>feature request:<br><br>- Can it be possible to recursively clone existing library target created with<br>add_library and all of its dependencies?<br>- Modify this cloned target to produce a set of *.bc files instead of a binary.<br>- Have this routine wrapped into a stable and portable CMake function like:<br>add_llvm_bitcode_target?<br><br>Thanks.<br></div>