How to use cmake build config to run llvm libclang tool that is not a plugin over my whole code base?
<p>I have written a llvm plugin and made a cmake object library that runs the plugin over each source file, but I need to have data from the whole compilation, whereas a plugin is run again for each compilation unit.   </p>

<p>My build environment is fairly complex, however, and I don't want to manage a second representation of the configuration just for running this tool.</p>

<p><strong>How can I use my existing CMakeLists.txt to send things like #define's and include paths to a tool that can run over my entire code base in one run?</strong></p>

<p>I've considered trying to use Coliru's unity build on a plugin, since it would be a single compilation unit, but was hoping for something built in to cmake (maybe combined with a few command line tools) that could get the information that I need.  I could also do a multi-pass run where I build up a bunch of data files and then make a different tool to combine those, but that's not ideal, either.</p>

<p>Thank you.</p>