[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ctags, etags and cscope support


Hello friends,

This patch includes support for ctags, etags and cscope to the
CMakeLists.txt. Comments are always welcome.

[]'s

-- 
Eduardo Otubo
Software Engineer
Linux Technology Center
IBM Systems & Technology Group
Mobile: +55 19 8135 0885 
otubo@xxxxxxxxxxxxxxxxxx
diff --git a/.gitignore b/.gitignore
index 4c2e190..7285d2f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
 build
 cscope.*
 tags
+TAGS
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d935827..4266262 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,11 @@ if (NOT CRYPTO_FOUND)
   endif (NOT GCRYPT_FOUND)
 endif (NOT CRYPTO_FOUND)
 
+# search for programs
+find_program(CTAGS ctags)
+find_program(ETAGS etags)
+find_program(CSCOPE cscope)
+
 # config.h checks
 include(ConfigureChecks.cmake)
 configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -68,3 +73,24 @@ if (UNIX AND NOT WIN32)
     target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY})
   endif (WITH_SFTP AND WITH_SERVER)
 endif (UNIX AND NOT WIN32)
+
+# Create ctags for vim, etc
+add_custom_target(ctags
+    COMMAND ${CTAGS} -R ${CMAKE_SOURCE_DIR}/libssh/*
+		COMMAND cp tags ${CMAKE_SOURCE_DIR}
+		COMMAND cp tags ${CMAKE_SOURCE_DIR}/libssh
+)
+
+# Create etags for emacs
+add_custom_target(etags
+    COMMAND ${ETAGS} -R ${CMAKE_SOURCE_DIR}/libssh/*
+		COMMAND cp TAGS ${CMAKE_SOURCE_DIR}
+		COMMAND cp TAGS ${CMAKE_SOURCE_DIR}/libssh
+)
+
+# Create cscope for both
+add_custom_target(cscope
+    COMMAND ${CSCOPE} -bR ${CMAKE_SOURCE_DIR}/libssh/*
+		COMMAND cp cscope.out ${CMAKE_SOURCE_DIR}
+		COMMAND cp cscope.out ${CMAKE_SOURCE_DIR}/libssh
+)

Follow-Ups:
Re: [PATCH] ctags, etags and cscope supportEduardo Otubo <otubo@xxxxxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org