upload_release.cmake 762 B

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