RunPzip.cmake 823 B

1234567891011121314151617181920212223
  1. function(run_pzip target_name source destination glob)
  2. file(GLOB_RECURSE files RELATIVE "${source}" "${source}/${glob}")
  3. set(dstfiles "")
  4. foreach(srcfile ${files})
  5. file(RELATIVE_PATH srcfile_rel "${destination}" "${source}/${srcfile}")
  6. file(RELATIVE_PATH dstfile_rel "${destination}" "${destination}/${srcfile}.pz")
  7. list(APPEND dstfiles "${dstfile_rel}")
  8. add_custom_command(OUTPUT "${dstfile_rel}"
  9. COMMAND pzip -c > "${dstfile_rel}" < "${srcfile_rel}"
  10. WORKING_DIRECTORY "${destination}"
  11. DEPENDS pzip
  12. COMMENT "")
  13. get_filename_component(dstdir "${destination}/${dstfile_rel}" DIRECTORY)
  14. file(MAKE_DIRECTORY "${dstdir}")
  15. endforeach(srcfile)
  16. add_custom_target(${target_name} ALL
  17. DEPENDS ${dstfiles}
  18. WORKING_DIRECTORY "${destination}")
  19. endfunction(run_pzip)