CMake/Utilities/Release/upload_release.cmake

40 lines
998 B
CMake
Raw Normal View History

set(CTEST_RUN_CURRENT_SCRIPT 0)
if(NOT VERSION)
2017-06-05 14:32:40 +00:00
set(VERSION 3.9)
endif()
if(NOT DEFINED PROJECT_PREFIX)
set(PROJECT_PREFIX cmake-${VERSION})
endif()
if(NOT DEFINED DIR)
set(DIR "v${VERSION}")
endif()
2006-10-16 16:47:07 +00:00
file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_PREFIX}*")
list(SORT FILES)
list(REVERSE FILES)
2006-10-16 16:47:07 +00:00
message("${FILES}")
set(UPLOAD_LOC
"kitware@www.cmake.org:/projects/FTP/pub/cmake/${DIR}")
set(count 0)
2006-10-16 16:47:07 +00:00
foreach(file ${FILES})
if(NOT IS_DIRECTORY ${file})
message("upload ${file} ${UPLOAD_LOC}")
execute_process(COMMAND
2006-10-16 16:47:07 +00:00
scp ${file} ${UPLOAD_LOC}
RESULT_VARIABLE result)
2006-10-16 16:47:07 +00:00
if("${result}" GREATER 0)
message(FATAL_ERROR "failed to upload file to ${UPLOAD_LOC}")
endif()
# Pause to give each upload a distinct (to the nearest second)
# time stamp
if(COMMAND ctest_sleep)
ctest_sleep(2)
endif()
math(EXPR count "${count} + 1")
endif()
endforeach()
if(${count} EQUAL 0)
message(FATAL_ERROR "Error no files uploaded.")
endif()