Update external dependencies on URL change (#2799)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 10 Jan 2019 02:17:51 +0000 (11:17 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 10 Jan 2019 02:17:51 +0000 (11:17 +0900)
With this commit, ExternalSource_Download will re-download external source
if its URL has changed.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
cmake/modules/ExternalSourceTools.cmake

index 3169d6f..dc61d1b 100644 (file)
@@ -35,6 +35,16 @@ function(ExternalSource_Download PREFIX)
     file(MAKE_DIRECTORY "${CACHE_DIR}")
   endif(NOT EXISTS "${CACHE_DIR}")
 
+  # Compare URL in STAMP file and the given URL
+  # - Remove STAMP if they are unmatched
+  if(EXISTS "${STAMP_PATH}")
+    file(READ ${STAMP_PATH} PREV_URL)
+
+    if(NOT URL STREQUAL PREV_URL)
+      file(REMOVE "${STAMP_PATH}")
+    endif(NOT URL STREQUAL PREV_URL)
+  endif(EXISTS "${STAMP_PATH}")
+
   if(NOT EXISTS "${STAMP_PATH}")
     file(REMOVE_RECURSE "${OUT_DIR}")
     file(REMOVE_RECURSE "${TMP_DIR}")