]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: do not try to add submodule to exclude list if .git is not around 14495/head
authorKefu Chai <kchai@redhat.com>
Thu, 13 Apr 2017 05:46:31 +0000 (13:46 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 13 Apr 2017 05:49:54 +0000 (13:49 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/CTags.cmake

index 7d40984f74969fd80bc0aaebe68585714237ed06..55b2288831165a84c79930678880afda86dab4a1 100644 (file)
@@ -12,13 +12,16 @@ function(add_tags name)
       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)
-    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})
+    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