diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4797c06011..08baca060e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2131,7 +2131,10 @@ bool HandleDownloadCommand(std::vector const& args, res = ::curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1); check_curl_result(res, "DOWNLOAD cannot set http failure option: "); - res = ::curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/" LIBCURL_VERSION); + curl_version_info_data* cv = curl_version_info(CURLVERSION_FIRST); + res = ::curl_easy_setopt( + curl, CURLOPT_USERAGENT, + cmStrCat("curl/", cv ? cv->version : LIBCURL_VERSION).c_str()); check_curl_result(res, "DOWNLOAD cannot set user agent option: "); res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cmWriteToFileCallback);