cmake: Add a link to the compile database for .clangd
authorAndreas Schneider <asn@samba.org>
Mon, 16 Mar 2020 15:53:11 +0000 (16:53 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 16 Mar 2020 15:53:11 +0000 (16:53 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
.gitignore
CMakeLists.txt

index 8fd13107643682bc94d9cd8b9f8c1a7377864fd5..4de573c26660a347086cfae1e54d787eb6e7551a 100644 (file)
@@ -7,3 +7,4 @@ build
 obj
 cscope.*
 tags
+compile_commands.json
index a3028aec3b15cafcdf6b08645c92df69a80a2a0b..45a2e2212af2f1f5edff38126a74ea03b1621733 100644 (file)
@@ -98,3 +98,8 @@ add_subdirectory(doc)
 # Add 'make dist' target which makes sure to invoke cmake before
 add_custom_target(dist
                   COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
+
+# Link combile database for clangd
+execute_process(COMMAND cmake -E create_symlink
+                "${CMAKE_BINARY_DIR}/compile_commands.json"
+                "${CMAKE_SOURCE_DIR}/compile_commands.json")