[llvm] r255789 - Generate a clang CompilationDatabase when running CMake

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 10:17:45 PST 2015


Author: d0k
Date: Wed Dec 16 12:17:45 2015
New Revision: 255789

URL: http://llvm.org/viewvc/llvm-project?rev=255789&view=rev
Log:
Generate a clang CompilationDatabase when running CMake

This generates a compile_commands.json file, which tells tools like
YouCompleteMe and clang_complete exactly how to build each source file.

Patch by Justin Lebar!

Modified:
    llvm/trunk/CMakeLists.txt

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=255789&r1=255788&r2=255789&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Wed Dec 16 12:17:45 2015
@@ -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)
+
 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)




More information about the llvm-commits mailing list