diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2016-09-19 12:41:00 (GMT) |
---|---|---|
committer | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2016-09-19 13:05:12 (GMT) |
commit | 0f424c3d07a613820950e04e00431d57ba7f829f (patch) | |
tree | 3d75b6f42e286bf46b1bfe865860f6734c23eff7 /Modules/ExternalProject.cmake | |
parent | c7b312cf13125b04e442cdcc2eb8725e8dfa5cbf (diff) | |
download | CMake-0f424c3d07a613820950e04e00431d57ba7f829f.zip CMake-0f424c3d07a613820950e04e00431d57ba7f829f.tar.gz CMake-0f424c3d07a613820950e04e00431d57ba7f829f.tar.bz2 |
ExternalProject: Add HTTP_HEADER
Diffstat (limited to 'Modules/ExternalProject.cmake')
-rw-r--r-- | Modules/ExternalProject.cmake | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 31fa459..79054a1 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -79,6 +79,8 @@ Create custom targets to build projects in external trees Username for download operation ``HTTP_PASSWORD <username>`` Password for download operation + ``HTTP_HEADER <header>`` + HTTP header for download operation. Suboption can be repeated several times. ``TLS_VERIFY <bool>`` Should certificate for https be checked ``TLS_CAINFO <file>`` @@ -862,7 +864,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) +function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_progress hash tls_verify tls_cainfo userpwd http_headers) if(timeout) set(TIMEOUT_ARGS TIMEOUT ${timeout}) set(TIMEOUT_MSG "${timeout} seconds") @@ -916,6 +918,16 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p set(USERPWD_ARGS USERPWD "${userpwd}") endif() + set(HTTP_HEADERS_ARGS "") + if(NOT http_headers STREQUAL "") + foreach(header ${http_headers}) + set( + HTTP_HEADERS_ARGS + "HTTPHEADER \"${header}\"\n ${HTTP_HEADERS_ARGS}" + ) + endforeach() + endif() + # Used variables: # * TLS_VERIFY_CODE # * TLS_CAINFO_CODE @@ -927,6 +939,7 @@ function(_ep_write_downloadfile_script script_filename REMOTE LOCAL timeout no_p # * TIMEOUT_ARGS # * TIMEOUT_MSG # * USERPWD_ARGS + # * HTTP_HEADERS_ARGS configure_file( "${_ExternalProject_SELF_DIR}/ExternalProject-download.cmake.in" "${script_filename}" @@ -1932,8 +1945,9 @@ function(_ep_add_download_command name) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) 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}") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}" "${http_username}:${http_password}" "${http_headers}") set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) if (no_extract) |