[CMake] about http_proxy env var for download with cmake
nader.akhres at laposte.net
nader.akhres at laposte.net
Mon Mar 29 08:06:49 EDT 2010
Just to give back some info I've found:
* it's recommanded to use http_proxy (with lower case), because upper case will be deprecated in last curl version:
"http_proxy is an exception as it is only available in lower case. " from http://curl.haxx.se/docs/manpage.html
* here is the syntax for proxy with authentication:
http_proxy=login:password at host:port
*here is a little macro I use to deal with http errors (which return no error!):
#DOWNLOAD() aims to correct bug from "file(download..." which don't deal with http errors
MACRO(FILE_DOWNLOAD url filename error_code error_message)
file(DOWNLOAD ${url} ${filename} STATUS DOWNLOAD_STATUS LOG DOWNLOAD_LOG)
#message(STATUS "STATUS=${DOWNLOAD_STATUS} LOG=${DOWNLOAD_LOG}")
LIST(GET DOWNLOAD_STATUS 0 ${error_code})
LIST(GET DOWNLOAD_STATUS 1 ${error_message})
IF(${error_code} EQUAL 0) #look for http error if any
string(REGEX MATCH "HTTP/1.[0-9] [0-9][0-9][0-9] [a-zA-Z ]*" ${error_message} ${DOWNLOAD_LOG})
string(REGEX MATCH "[0-9][0-9][0-9]" ${error_code} ${${error_message}})
string(REGEX REPLACE "HTTP/1.[0-9] [0-9][0-9][0-9] " "" ${error_message} ${${error_message}})
IF(${error_code} EQUAL 200)
set(${error_code} 0)
ENDIF(${error_code} EQUAL 200)
ENDIF(${error_code} EQUAL 0)
IF(NOT (${error_code} EQUAL 0)) #remove partial file if any error
file(REMOVE ${filename})
ENDIF(NOT (${error_code} EQUAL 0))
#message(STATUS "error_code=${${error_code}}")
#message(STATUS "error_message=${${error_message}}")
ENDMACRO(FILE_DOWNLOAD)
Laposte.net, Messager Officiel du Rallye des Gazelles 2010, Pour suivre le Rallye Aicha des Gazelles et soutenir les participantes,
cliquez ici http://www.laposte.net/rallye-des-gazelles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100329/3893d794/attachment.htm>
More information about the CMake
mailing list