summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2019-10-22 09:21:05 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-10-25 10:15:34 +0200
commitff70e53b65e700db6c53c48eaa84fba77b815450 (patch)
tree32abf4ed5b99f4351d20581af43140bc7c753a29
parent1a41f98a6ba0fedcb6338396b27bea1ecf4a3998 (diff)
downloadcmocka-ff70e53b65e700db6c53c48eaa84fba77b815450.zip
cmocka-ff70e53b65e700db6c53c48eaa84fba77b815450.tar.gz
cmocka-ff70e53b65e700db6c53c48eaa84fba77b815450.tar.bz2
cmake: Link compile database to source dir for clangd
See https://github.com/ycm-core/YouCompleteMe https://github.com/abingham/emacs-ycmd Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--.gitignore2
-rw-r--r--CMakeLists.txt5
2 files changed, 7 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3944fce..e6731b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,7 @@
tags
cscope.*
.ycm_extra_conf.pyc
+compile_commands.json
+/.clangd
/build
/obj*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3e9193..7e3ede3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,3 +113,8 @@ install(
# 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")