Skip to content

Instantly share code, notes, and snippets.

@jcfr
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcfr/a9ceafe9e794b033d433 to your computer and use it in GitHub Desktop.
Save jcfr/a9ceafe9e794b033d433 to your computer and use it in GitHub Desktop.
Short CMake script attempting to download Python-2.7.3.tgz. It has been created in an attempt to reproduce issue discussed here: http://slicer-devel.65872.n3.nabble.com/Problems-downloading-packages-on-Windows-during-Slicer-build-tt4031572.html
set(file "./Python-2.7.3.tgz")
message(STATUS "Removing ${file}")
file(REMOVE ${file})
message(STATUS "Removing ${file} - done")
message(STATUS "Downloading ${file}")
file(
DOWNLOAD https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz ${file}
SHOW_PROGRESS
STATUS status
)
list(GET status 0 error_code)
list(GET status 1 error_msg)
if(error_code)
message(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}")
endif()
message(STATUS "Downloading ${file} - done")
@jcfr
Copy link
Author

jcfr commented Aug 25, 2014

To execute the script:

  1. Download the script
  2. Open a terminal, then execute doing:
cmake -P cmake_python_download.cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment