upload_release.cmake 998 Bytes
Newer Older
1
set(CTEST_RUN_CURRENT_SCRIPT 0)
2
if(NOT VERSION)
Brad King's avatar
Brad King committed
3
 set(VERSION 3.9)
4
endif()
5
6
7
if(NOT DEFINED PROJECT_PREFIX)
  set(PROJECT_PREFIX cmake-${VERSION})
endif()
8
9
if(NOT DEFINED DIR)
  set(DIR "v${VERSION}")
10
endif()
Bill Hoffman's avatar
Bill Hoffman committed
11
file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_PREFIX}*")
12
13
list(SORT FILES)
list(REVERSE FILES)
Bill Hoffman's avatar
Bill Hoffman committed
14
15
message("${FILES}")
set(UPLOAD_LOC
16
  "kitware@www.cmake.org:/projects/FTP/pub/cmake/${DIR}")
17
set(count 0)
Bill Hoffman's avatar
Bill Hoffman committed
18
19
foreach(file ${FILES})
  if(NOT IS_DIRECTORY ${file})
20
    message("upload ${file} ${UPLOAD_LOC}")
21
    execute_process(COMMAND
Bill Hoffman's avatar
Bill Hoffman committed
22
      scp ${file} ${UPLOAD_LOC}
23
      RESULT_VARIABLE result)
Bill Hoffman's avatar
Bill Hoffman committed
24
25
    if("${result}" GREATER 0)
      message(FATAL_ERROR "failed to upload file to ${UPLOAD_LOC}")
26
    endif()
27
28
29
30
31
32
33
34

    # 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")
35
  endif()
36
endforeach()
37
38
if(${count} EQUAL 0)
   message(FATAL_ERROR "Error no files uploaded.")
39
endif()