aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-05-12 08:29:11 +0200
committerSven Göthel <[email protected]>2024-05-12 08:29:11 +0200
commite96545e9f1e46b091dc8b305a6a3657374fb31b3 (patch)
treec77f19def0ea3eb13030280e547dae0970d06b78
parent999f54787a1e309abbafcf566543aa1b57b772b5 (diff)
Produce ${CMAKE_CURRENT_SOURCE_DIR}/.clangd w/ cmake configuration if not existing (deleted the git-repo version), allowing to set all absolute path properly
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/modules/clangd.in (renamed from .clangd)6
3 files changed, 11 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 66205fa..43cc61b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ snaps/
/compile_commands.json
*~
*.log
+.clangd
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b86ed7..af52bce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,14 @@ endif()
include(WasmSetup.cmake)
JaulibSetup()
+if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.clangd)
+# Fixup clangd w/ absolute path
+set (gamp_clangd_source_args "-isystem, ${CMAKE_CURRENT_SOURCE_DIR}/jaulib/include, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/jaulib/src, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/jaulib/java_jni/jni, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/jaulib/java_jni/jni/jau, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/jaulib/test")
+set (gamp_clangd_source_args "${gamp_clangd_source_args} -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/include, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/src, -isystem, ${CMAKE_CURRENT_SOURCE_DIR}/test")
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/clangd.in
+ ${CMAKE_CURRENT_SOURCE_DIR}/.clangd)
+endif()
+
# this is the library version, derived from git tag and revision
set (gamp_VERSION_MAJOR ${VERSION_MAJOR})
set (gamp_VERSION_MINOR ${VERSION_MINOR})
diff --git a/.clangd b/cmake/modules/clangd.in
index 58bfe1b..9388250 100644
--- a/.clangd
+++ b/cmake/modules/clangd.in
@@ -13,11 +13,9 @@
# modernize-use-default-member-init.UseAssignment: true
# Tell clangd to use the compile_commands.json file in the build/default folder
-# Add: [-isystem, /usr/local/projects/jausoft/gamp/jaulib/include]
-# Add: [-isystem, ../jaulib/include]
CompileFlags:
- CompilationDatabase: build/default
- Add: [-isystem, /usr/local/projects/jausoft/gamp/jaulib/include]
+ CompilationDatabase: @CMAKE_CURRENT_BINARY_DIR@
+ Add: [@gamp_clangd_source_args@]
Diagnostics:
UnusedIncludes: Strict