upload_release.cmake 796 B

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