diff Resources/CMake/DownloadPackage.cmake @ 634:d775a3cb5a06

refactoring of CMake scripts
author jodogne
date Tue, 29 Oct 2013 10:31:02 +0100
parents 49945044b06d
children ee0d5abf7958
line wrap: on
line diff
--- a/Resources/CMake/DownloadPackage.cmake	Tue Oct 29 09:04:25 2013 +0100
+++ b/Resources/CMake/DownloadPackage.cmake	Tue Oct 29 10:31:02 2013 +0100
@@ -40,6 +40,15 @@
     set(TMP_PATH "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${TMP_FILENAME}")
     if (NOT EXISTS "${TMP_PATH}")
       message("Downloading ${Url}")
+
+      # This fixes issue 6: "I think cmake shouldn't download the
+      # packages which are not in the system, it should stop and let
+      # user know."
+      # https://code.google.com/p/orthanc/issues/detail?id=6
+      if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
+	message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
+      endif()
+
       file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS EXPECTED_MD5 "${MD5}")
     else()
       message("Using local copy of ${Url}")