mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'curl_netrc_options'
d45aa38aAdd dev notes for topic 'curl_netrc_options'60c272b6ExternalProject: Add support for NETRC and NETRC_FILE suboption754e39ddAdd testcases for file(DOWNLOAD|UPLOAD) netrc options5d67e902file(DOWNLOAD|UPLOAD): Add 'NETRC' and 'NETRC_FILE' suboption Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Ruslan Baratov <ruslan_baratov@yahoo.com> Merge-request: !1376
This commit is contained in:
@@ -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.
|
||||
@@ -1346,7 +1368,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")
|
||||
@@ -1371,6 +1393,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)
|
||||
@@ -1379,6 +1403,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
|
||||
@@ -1393,6 +1423,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)
|
||||
@@ -2436,11 +2476,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)
|
||||
|
||||
Reference in New Issue
Block a user