From e632f68789cc5b69b84b6344402d6b6f1bf6abb2 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Thu, 29 Dec 2011 13:04:17 +0100 Subject: [PATCH] cmake: generate tags --- CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c0ef2389..764519350 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) OPTION (BUILD_TESTS "Build Tests" ON) OPTION (BUILD_CLAY "Build Tests using the Clay suite" OFF) +OPTION (TAGS "Generate tags" OFF) # Platform specific compilation flags IF (MSVC) @@ -168,3 +169,22 @@ IF (BUILD_CLAY) ENABLE_TESTING() ADD_TEST(libgit2_clay libgit2_clay) ENDIF () + +IF (TAGS) + FIND_PROGRAM(CTAGS ctags) + IF (NOT CTAGS) + message(FATAL_ERROR "Could not find ctags command") + ENDIF () + + FILE(GLOB_RECURSE SRC_ALL *.[ch]) + + ADD_CUSTOM_COMMAND( + OUTPUT tags + COMMAND ${CTAGS} -a ${SRC_ALL} + DEPENDS ${SRC_ALL} + ) + ADD_CUSTOM_TARGET( + do_tags ALL + DEPENDS tags + ) +ENDIF ()