[PATCH] Generate a clang CompilationDatabase when running CMake.
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 10:53:26 PST 2015
Justin Lebar via llvm-commits <llvm-commits at lists.llvm.org> writes:
> This generates a compile_commands.json file, which tells tools like
> YouCompleteMe and clang_complete exactly how to build each source file.
> ---
> CMakeLists.txt | 4 ++++
> 1 file changed, 4 insertions(+)
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index fc46413..208c0a8 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -86,6 +86,10 @@ set(CMAKE_MODULE_PATH
> "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
> )
>
> +# Generate a CompilationDatabase (compile_commands.json file) for our build,
> +# for use by clang_complete, YouCompleteMe, etc.
> +set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
We already document to do this on the command line in all of the tooling
docs, does it actually make sense to default this to on? I suppose as
long as this is fast to do (I haven't checked, is it?) there's no harm
in it.
> +
> option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OFF)
>
> option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list