[cfe-dev] CompilationDatabase support added to libclang and python binding

Stephen Kelly steveire at gmail.com
Wed Jun 13 10:19:33 PDT 2012


David Röthlisberger wrote:

> On 12 Jun 2012, at 19:04, Manuel Klimek wrote:
>> 
>> http://clang.llvm.org/docs/JSONCompilationDatabase.html
>> 
>> Feeback or patches welcome :)
> 
> Thanks Manuel -- that was quick!
> 
> 
> SUPPORTED SYSTEMS
> 
> * Since which version of CMake?

The CMake makefile generators since 2.8.5 I believe. For the Ninja 
generator, it has just been merged, and will be part of CMAke 2.8.9 released 
in a few weeks.

> 
> * Give an example of how to add the option to a CMakeLists.txt, and how
>   to specify the option on the command-line when not present in the
>   CMakeLists.txt.

Typically it won't be in the CMakeLists.txt, but set on the command line:

cmake $srcdir -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

or 

cmake $srcdir -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja

to use the Ninja generator


> 
> * Out of curiosity, how hard would it be to implement for other CMake
>   targets (like Visual Studio projects) -- presumably the compilation
>   command would be different, but everything else can be re-used?

I don't know this one, but indeed it probably just depends on someone caring 
enough to implement and debug it and make sure the unit test passes (the 
unit test for the generation of the file does not currently work on Windows 
with the Ninja generator - that will also take someone debugging it on a 
Windows machine to find out why)

Thanks,

Steve.





More information about the cfe-dev mailing list