summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-05-01 19:20:23 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-05-20 08:17:05 +0200
commit44ca111c2b9cf45491edc99062f89c89060525ae (patch)
treea7fa29b3c6789973ac0ed902f6d772a0971394c1
parent6cd68ca0e61311cd4d6177b4c564432865a84a23 (diff)
downloadouroboros-44ca111c2b9cf45491edc99062f89c89060525ae.tar.gz
ouroboros-44ca111c2b9cf45491edc99062f89c89060525ae.zip
build: Add a 'tags' target for ctags index generation
The build will now detect presence of ctags, and allows generating a tags file with 'make tags' for convenience. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/tags.cmake21
3 files changed, 23 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 43f47a46..b10e8173 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*~
*#
build/
+/tags
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c886146d..bfabd711 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,5 +69,6 @@ add_subdirectory(src/ipcpd)
add_subdirectory(src/tools)
setup_coverage_target()
include(doc)
+include(tags)
include(install)
diff --git a/cmake/tags.cmake b/cmake/tags.cmake
new file mode 100644
index 00000000..00e6f0d6
--- /dev/null
+++ b/cmake/tags.cmake
@@ -0,0 +1,21 @@
+find_program(CTAGS_EXECUTABLE
+ NAMES ctags-universal universal-ctags ctags
+ DOC "Generate a ctags index for source navigation: make tags")
+mark_as_advanced(CTAGS_EXECUTABLE)
+
+if(CTAGS_EXECUTABLE)
+ add_custom_target(tags
+ COMMAND ${CTAGS_EXECUTABLE}
+ -R
+ --languages=C
+ --c-kinds=+p
+ --fields=+S
+ --exclude=build
+ --exclude=build-claude
+ --exclude=build_tmp
+ --exclude=.git
+ -f ${CMAKE_SOURCE_DIR}/tags
+ ${CMAKE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMENT "Generating ctags index at ${CMAKE_SOURCE_DIR}/tags")
+endif()