upload_release.cmake 1017 B

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