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

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