comparison 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
comparison
equal deleted inserted replaced
633:e207b33216db 634:d775a3cb5a06
38 GetUrlFilename(TMP_FILENAME "${Url}") 38 GetUrlFilename(TMP_FILENAME "${Url}")
39 39
40 set(TMP_PATH "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${TMP_FILENAME}") 40 set(TMP_PATH "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${TMP_FILENAME}")
41 if (NOT EXISTS "${TMP_PATH}") 41 if (NOT EXISTS "${TMP_PATH}")
42 message("Downloading ${Url}") 42 message("Downloading ${Url}")
43
44 # This fixes issue 6: "I think cmake shouldn't download the
45 # packages which are not in the system, it should stop and let
46 # user know."
47 # https://code.google.com/p/orthanc/issues/detail?id=6
48 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS)
49 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON")
50 endif()
51
43 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS EXPECTED_MD5 "${MD5}") 52 file(DOWNLOAD "${Url}" "${TMP_PATH}" SHOW_PROGRESS EXPECTED_MD5 "${MD5}")
44 else() 53 else()
45 message("Using local copy of ${Url}") 54 message("Using local copy of ${Url}")
46 endif() 55 endif()
47 56