aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2019-10-25 10:14:28 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-10-25 17:29:10 +0200
commita4b95268eef8283c7edaba69d6fe597cf2b754af (patch)
treef03d5f7d90621ccd217f103c48a3f017724d3d69
parent8a50dbc6ba33cf1f2596a07927eec309edf809b3 (diff)
downloadlibssh-a4b95268eef8283c7edaba69d6fe597cf2b754af.tar.gz
libssh-a4b95268eef8283c7edaba69d6fe597cf2b754af.tar.xz
libssh-a4b95268eef8283c7edaba69d6fe597cf2b754af.zip
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> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--.gitignore2
-rw-r--r--CMakeLists.txt5
-rw-r--r--CPackConfig.cmake2
3 files changed, 8 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 0baa4fa1..da6827ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@
*.swp
*~$
cscope.*
+compile_commands.json
+/.clangd
tags
/build
/obj*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5dce15e1..21d6fcad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,6 +205,11 @@ endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS ${_SYMBOL_TARGET})
+# Link compile database for clangd
+execute_process(COMMAND cmake -E create_symlink
+ "${CMAKE_BINARY_DIR}/compile_commands.json"
+ "${CMAKE_SOURCE_DIR}/compile_commands.json")
+
message(STATUS "********************************************")
message(STATUS "********** ${PROJECT_NAME} build options : **********")
diff --git a/CPackConfig.cmake b/CPackConfig.cmake
index 51b300cc..90065139 100644
--- a/CPackConfig.cmake
+++ b/CPackConfig.cmake
@@ -10,7 +10,7 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
# SOURCE GENERATOR
set(CPACK_SOURCE_GENERATOR "TXZ")
-set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
+set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;/[.]clangd/;.gitignore;/build*;/obj*;tags;cscope.*;compile_commands.json")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
### NSIS INSTALLER