upload_release.cmake 999 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. set(CTEST_RUN_CURRENT_SCRIPT 0)
  2. if(NOT VERSION)
  3. set(VERSION 3.11)
  4. endif()
  5. if(NOT DEFINED PROJECT_PREFIX)
  6. set(PROJECT_PREFIX cmake-${VERSION})
  7. endif()
  8. if(NOT DEFINED DIR)
  9. set(DIR "v${VERSION}")
  10. endif()
  11. file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_PREFIX}*")
  12. list(SORT FILES)
  13. list(REVERSE FILES)
  14. message("${FILES}")
  15. set(UPLOAD_LOC
  16. "kitware@www.cmake.org:/projects/FTP/pub/cmake/${DIR}")
  17. set(count 0)
  18. foreach(file ${FILES})
  19. if(NOT IS_DIRECTORY ${file})
  20. message("upload ${file} ${UPLOAD_LOC}")
  21. execute_process(COMMAND
  22. scp ${file} ${UPLOAD_LOC}
  23. RESULT_VARIABLE result)
  24. if("${result}" GREATER 0)
  25. message(FATAL_ERROR "failed to upload file to ${UPLOAD_LOC}")
  26. endif()
  27. # Pause to give each upload a distinct (to the nearest second)
  28. # time stamp
  29. if(COMMAND ctest_sleep)
  30. ctest_sleep(2)
  31. endif()
  32. math(EXPR count "${count} + 1")
  33. endif()
  34. endforeach()
  35. if(${count} EQUAL 0)
  36. message(FATAL_ERROR "Error no files uploaded.")
  37. endif()