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