diff options
author | Shane Parris <shane.lee.parris@gmail.com> | 2017-10-18 14:28:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-18 19:21:43 (GMT) |
commit | 60c272b69ae1c3363aba02488c04c83f66264251 (patch) | |
tree | 313d3b4fb66684bc673f5b8864f61ce861e05f98 /Modules/ExternalProject.cmake | |
parent | 754e39dd36cdeea4a15fca9ef9fa29f0fa8006d4 (diff) | |
download | CMake-60c272b69ae1c3363aba02488c04c83f66264251.zip CMake-60c272b69ae1c3363aba02488c04c83f66264251.tar.gz CMake-60c272b69ae1c3363aba02488c04c83f66264251.tar.bz2 |
ExternalProject: Add support for NETRC and NETRC_FILE suboption
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 76f5080..c041f03 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -193,6 +193,28 @@ External Project Definition ``CMAKE_TLS_CAINFO`` variable will be used instead (see :command:`file(DOWNLOAD)`) + ``NETRC <level>`` + Specify whether the .netrc file is to be used for operation. If this + option is not specified, the value of the ``CMAKE_NETRC`` variable + will be used instead (see :command:`file(DOWNLOAD)`) + Valid levels are: + + ``IGNORED`` + The .netrc file is ignored. + This is the default. + ``OPTIONAL`` + The .netrc file is optional, and information in the URL is preferred. + The file will be scanned to find which ever information is not specified + in the URL. + ``REQUIRED`` + The .netrc file is required, and information in the URL is ignored. + + ``NETRC_FILE <file>`` + Specify an alternative .netrc file to the one in your home directory + if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option + is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will + be used instead (see :command:`file(DOWNLOAD)`) + *Git* NOTE: A git version of 1.6.5 or later is required if this download method is used. @@ -1343,7 +1365,7 @@ endif() endfunction(_ep_write_gitupdate_script) -function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers) +function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers netrc netrc_file) if(timeout) set(TIMEOUT_ARGS TIMEOUT ${timeout}) set(TIMEOUT_MSG "${timeout} seconds") @@ -1368,6 +1390,8 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p set(TLS_VERIFY_CODE "") set(TLS_CAINFO_CODE "") + set(NETRC_CODE "") + set(NETRC_FILE_CODE "") # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) @@ -1376,6 +1400,12 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p if(DEFINED CMAKE_TLS_CAINFO) set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") endif() + if(DEFINED CMAKE_NETRC) + set(NETRC_CODE "set(CMAKE_NETRC \"${CMAKE_NETRC}\")") + endif() + if(DEFINED CMAKE_NETRC_FILE) + set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${CMAKE_NETRC_FILE}\")") + endif() # now check for curl locals so that the local values # will override the globals @@ -1390,6 +1420,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p if(tls_cainfo_len GREATER 0) set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() + # check for netrc argument + string(LENGTH "${netrc}" netrc_len) + if(netrc_len GREATER 0) + set(NETRC_CODE "set(CMAKE_NETRC \"${netrc}\")") + endif() + # check for netrc_file argument + string(LENGTH "${netrc_file}" netrc_file_len) + if(netrc_file_len GREATER 0) + set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${netrc_file}\")") + endif() if(userpwd STREQUAL ":") set(USERPWD_ARGS) @@ -2433,11 +2473,13 @@ function(_ep_add_download_command name) get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) + get_property(netrc TARGET ${name} PROPERTY _EP_NETRC) + get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE) get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME) get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD) get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER) set(download_script "${stamp_dir}/download-${name}.cmake") - _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}" "${netrc}" "${netrc_file}") set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) if (no_extract) |