Check url for external source download (#3275)
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 22 Oct 2018 02:50:51 +0000 (11:50 +0900)
committer이춘석/동작제어Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Mon, 22 Oct 2018 02:50:51 +0000 (11:50 +0900)
Check url for external source download
If download url is not matched, download again

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
cmake/modules/ExternalSourceTools.cmake

index cb18514..c6900a2 100644 (file)
@@ -12,7 +12,16 @@ function(ExternalSource_Download PREFIX URL)
     file(MAKE_DIRECTORY "${CACHE_DIR}")
   endif(NOT EXISTS "${CACHE_DIR}")
 
-  if(NOT EXISTS "${STAMP_PATH}")
+  # TODO Check MD5 for correctness
+  set(MATCH_URL FALSE)
+  if(EXISTS "${STAMP_PATH}")
+    file(READ "${STAMP_PATH}" SAVED_URL)
+    if("${SAVED_URL}" STREQUAL "${URL}")
+      set(MATCH_URL TRUE)
+    endif("${SAVED_URL}" STREQUAL "${URL}")
+  endif(EXISTS "${STAMP_PATH}")
+
+  if(NOT EXISTS "${STAMP_PATH}" OR NOT MATCH_URL)
     file(REMOVE_RECURSE "${OUT_DIR}")
     file(REMOVE_RECURSE "${TMP_DIR}")