ExternalData: Remove compatibility with CMake < 2.8.5

Now that the module comes in a sufficiently new CMake it does not need
to support older versions.
This commit is contained in:
Brad King 2013-01-24 13:34:12 -05:00
parent ab26249db1
commit 00d801fbfe
1 changed files with 6 additions and 17 deletions

View File

@ -119,8 +119,7 @@
# Variables ExternalData_TIMEOUT_INACTIVITY and ExternalData_TIMEOUT_ABSOLUTE # Variables ExternalData_TIMEOUT_INACTIVITY and ExternalData_TIMEOUT_ABSOLUTE
# set the download inactivity and absolute timeouts, in seconds. The defaults # set the download inactivity and absolute timeouts, in seconds. The defaults
# are 60 seconds and 300 seconds, respectively. Set either timeout to 0 # are 60 seconds and 300 seconds, respectively. Set either timeout to 0
# seconds to disable enforcement. The inactivity timeout is enforced only # seconds to disable enforcement.
# with CMake >= 2.8.5.
#============================================================================= #=============================================================================
# Copyright 2010-2013 Kitware, Inc. # Copyright 2010-2013 Kitware, Inc.
@ -263,13 +262,7 @@ function(_ExternalData_compute_hash var_hash algo file)
endfunction() endfunction()
function(_ExternalData_random var) function(_ExternalData_random var)
if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.5) string(RANDOM LENGTH 6 random)
string(RANDOM LENGTH 6 random)
elseif(EXISTS /dev/urandom)
file(READ /dev/urandom random LIMIT 4 HEX)
else()
message(FATAL_ERROR "CMake >= 2.8.5 required in this environment")
endif()
set("${var}" "${random}" PARENT_SCOPE) set("${var}" "${random}" PARENT_SCOPE)
endfunction() endfunction()
@ -550,14 +543,10 @@ function(_ExternalData_download_file url file err_var msg_var)
set(retry 3) set(retry 3)
while(retry) while(retry)
math(EXPR retry "${retry} - 1") math(EXPR retry "${retry} - 1")
if("${CMAKE_VERSION}" VERSION_GREATER 2.8.4.20110602) if(ExternalData_TIMEOUT_INACTIVITY)
if(ExternalData_TIMEOUT_INACTIVITY) set(inactivity_timeout INACTIVITY_TIMEOUT ${ExternalData_TIMEOUT_INACTIVITY})
set(inactivity_timeout INACTIVITY_TIMEOUT ${ExternalData_TIMEOUT_INACTIVITY}) elseif(NOT "${ExternalData_TIMEOUT_INACTIVITY}" EQUAL 0)
elseif(NOT "${ExternalData_TIMEOUT_INACTIVITY}" EQUAL 0) set(inactivity_timeout INACTIVITY_TIMEOUT 60)
set(inactivity_timeout INACTIVITY_TIMEOUT 60)
else()
set(inactivity_timeout "")
endif()
else() else()
set(inactivity_timeout "") set(inactivity_timeout "")
endif() endif()