Skip to content

Commit 2c57120

Browse files
committed
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! llvm-svn: 255789
1 parent e2831b4 commit 2c57120

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ set(CMAKE_MODULE_PATH
8686
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
8787
)
8888

89+
# Generate a CompilationDatabase (compile_commands.json file) for our build,
90+
# for use by clang_complete, YouCompleteMe, etc.
91+
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
92+
8993
option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OFF)
9094

9195
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)

0 commit comments

Comments
 (0)