upload_release.cmake 804 B

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