summaryrefslogtreecommitdiff
path: root/CMake/SourceNavigation.cmake
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
commit76956486fa7ef52a51d4e56df1e13a9f19a6c93c (patch)
treefe0c394439fdc167d1970372e8998874090854dd /CMake/SourceNavigation.cmake
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
parentffc62c792c9a5196cb4ce7a353287dfe20db6524 (diff)
Update upstream source from tag 'upstream/3.3.0_beta1+dfsg'
Update to upstream version '3.3.0~beta1+dfsg' with Debian dir 85037bbb9376721108594b59b54ead82ac6924a3
Diffstat (limited to 'CMake/SourceNavigation.cmake')
-rw-r--r--CMake/SourceNavigation.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/CMake/SourceNavigation.cmake b/CMake/SourceNavigation.cmake
new file mode 100644
index 00000000..eb3888d3
--- /dev/null
+++ b/CMake/SourceNavigation.cmake
@@ -0,0 +1,41 @@
+find_program (CTAGS NAMES universal-ctags ctags-universal exuberant-ctags ctags-exuberant ctags)
+find_program (ETAGS NAMES etags etags.emacs)
+
+foreach (_tag_target IN ITEMS ctags etags)
+ string (TOUPPER "${_tag_target}" _tag_variable)
+ if (NOT ${_tag_variable})
+ continue ()
+ endif ()
+
+ execute_process (
+ COMMAND "${${_tag_variable}}" --version
+ RESULT_VARIABLE _tag_result
+ OUTPUT_VARIABLE _tag_version
+ ERROR_QUIET
+ )
+ if (_tag_result STREQUAL "0" AND _tag_version MATCHES "(Universal|Exuberant) Ctags")
+ set (_tag_tool_kind ctags)
+ elseif (_tag_result STREQUAL "0" AND _tag_target STREQUAL "etags" AND _tag_version MATCHES "GNU Emacs")
+ set (_tag_tool_kind emacs)
+ else ()
+ message (STATUS "Skipping ${_tag_target} target: unsupported tool ${${_tag_variable}}")
+ continue ()
+ endif ()
+
+ if (_tag_target STREQUAL "ctags")
+ set (_tag_file tags)
+ else ()
+ set (_tag_file TAGS)
+ endif ()
+ add_custom_target (${_tag_target}
+ COMMAND "${CMAKE_COMMAND}"
+ "-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ "-DTAG_TOOL=${${_tag_variable}}"
+ "-DTAG_TOOL_KIND=${_tag_tool_kind}"
+ "-DTAG_FILE=${_tag_file}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/generate_tags.cmake"
+ COMMENT "Generating ${_tag_file} for source navigation"
+ VERBATIM
+ )
+endforeach ()