summaryrefslogtreecommitdiffstats
path: root/src/ceph/cmake/modules/CTags.cmake
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2018-01-04 13:43:33 +0800
committerQiaowei Ren <qiaowei.ren@intel.com>2018-01-05 11:59:39 +0800
commit812ff6ca9fcd3e629e49d4328905f33eee8ca3f5 (patch)
tree04ece7b4da00d9d2f98093774594f4057ae561d4 /src/ceph/cmake/modules/CTags.cmake
parent15280273faafb77777eab341909a3f495cf248d9 (diff)
initial code repo
This patch creates initial code repo. For ceph, luminous stable release will be used for base code, and next changes and optimization for ceph will be added to it. For opensds, currently any changes can be upstreamed into original opensds repo (https://github.com/opensds/opensds), and so stor4nfv will directly clone opensds code to deploy stor4nfv environment. And the scripts for deployment based on ceph and opensds will be put into 'ci' directory. Change-Id: I46a32218884c75dda2936337604ff03c554648e4 Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Diffstat (limited to 'src/ceph/cmake/modules/CTags.cmake')
-rw-r--r--src/ceph/cmake/modules/CTags.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ceph/cmake/modules/CTags.cmake b/src/ceph/cmake/modules/CTags.cmake
new file mode 100644
index 0000000..55b2288
--- /dev/null
+++ b/src/ceph/cmake/modules/CTags.cmake
@@ -0,0 +1,40 @@
+find_program(CTAGS_EXECUTABLE ctags)
+
+function(add_tags name)
+ cmake_parse_arguments(TAGS "" "SRC_DIR;TAG_FILE" "EXCLUDE_OPTS;EXCLUDES" ${ARGN})
+ set(excludes ${TAGS_EXCLUDES})
+ if(TAGS_EXCLUDE_OPTS)
+ # always respect EXCLUDES_OPTS
+ list(APPEND excludes ${TAGS_EXCLUDE_OPTS})
+ else()
+ # exclude the submodules under SRC_DIR by default
+ execute_process(
+ COMMAND git config --file .gitmodules --get-regexp path
+ COMMAND awk "/${TAGS_SRC_DIR}/ { print $2 }"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ RESULT_VARIABLE result_code
+ OUTPUT_VARIABLE submodules
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(${result_code} EQUAL 0)
+ string(REPLACE "${TAGS_SRC_DIR}/" "" submodules ${submodules})
+ # cmake list uses ";" as the delimiter, so split the string manually
+ # before iterating in it.
+ string(REPLACE "\n" ";" submodules ${submodules})
+ list(APPEND excludes ${submodules})
+ endif()
+ endif()
+ message(STATUS "exclude following files under ${TAGS_SRC_DIR}: ${excludes}")
+ # add_custom_target() accepts a list after "COMMAND" keyword, so we should
+ # make exclude_arg a list, otherwise cmake will quote it. and ctags will
+ # take it as as a single argument.
+ foreach(exclude ${excludes})
+ list(APPEND exclude_args --exclude=${exclude})
+ endforeach()
+ add_custom_target(${name}
+ COMMAND ${CTAGS_EXECUTABLE} -R --c++-kinds=+p --fields=+iaS --extra=+q ${exclude_args}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/${TAGS_SRC_DIR}
+ COMMENT "Building ctags file ${TAGS_TAG_FILE}"
+ VERBATIM)
+ set_source_files_properties(${CMAKE_SOURCE_DIR}/${TAGS_TAG_FILE} PROPERTIES
+ GENERATED true)
+endfunction()