ExternalSource_Download with URL keyword (#2784)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 8 Jan 2019 08:38:46 +0000 (17:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 8 Jan 2019 08:38:46 +0000 (17:38 +0900)
This commit updates ExternalSource_Download to accept URL keyword as an
argument of the following form:

 ExternalSource_Download(SAMPLE DIRNAME "SAMPLE" URL "...")

This change will make it easy to understand CMake build script.

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

index d75ce2e..3169d6f 100644 (file)
@@ -1,10 +1,18 @@
 #
 # ExternalSource_Download(VAR ...)
 #
-function(ExternalSource_Download PREFIX URL)
+function(ExternalSource_Download PREFIX)
   include(CMakeParseArguments)
 
-  cmake_parse_arguments(ARG "" "DIRNAME" "" ${ARGN})
+  cmake_parse_arguments(ARG "" "DIRNAME;URL" "" ${ARGN})
+
+  # Configure URL
+  if(ARG_URL)
+    set(URL ${ARG_URL})
+  else()
+    # Use the first unparsed argument as URL (for backward compatibility)
+    list(GET ARG_UNPARSED_ARGUMENTS 0 URL)
+  endif(ARG_URL)
 
   # Configure DIRNAME
   if(NOT ARG_DIRNAME)