CMake: Clean up run_pzip
This should get rid of stray directories in the build directory on Windows.
This commit is contained in:
parent
149303f04c
commit
f696bfbfe2
|
|
@ -10,20 +10,23 @@ function(run_pzip target_name source destination glob)
|
|||
file(GLOB_RECURSE files RELATIVE "${source}" "${source}/${glob}")
|
||||
|
||||
set(dstfiles "")
|
||||
foreach(srcfile ${files})
|
||||
file(RELATIVE_PATH srcfile_rel "${destination}" "${source}/${srcfile}")
|
||||
file(RELATIVE_PATH dstfile_rel "${destination}" "${destination}/${srcfile}.pz")
|
||||
foreach(filename ${files})
|
||||
string(REGEX REPLACE "^/" "" filename "${filename}")
|
||||
file(RELATIVE_PATH srcfile "${destination}" "${source}/${filename}")
|
||||
|
||||
list(APPEND dstfiles "${dstfile_rel}")
|
||||
add_custom_command(OUTPUT "${dstfile_rel}"
|
||||
COMMAND pzip -c > "${dstfile_rel}" < "${srcfile_rel}"
|
||||
get_filename_component(dstdir "${destination}/${filename}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${dstdir}")
|
||||
|
||||
set(dstfile "${filename}.pz")
|
||||
list(APPEND dstfiles "${destination}/${dstfile}")
|
||||
|
||||
add_custom_command(OUTPUT "${destination}/${dstfile}"
|
||||
COMMAND pzip -c > "${dstfile}" < "${srcfile}"
|
||||
WORKING_DIRECTORY "${destination}"
|
||||
DEPENDS pzip
|
||||
COMMENT "")
|
||||
|
||||
get_filename_component(dstdir "${destination}/${dstfile_rel}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${dstdir}")
|
||||
endforeach(srcfile)
|
||||
endforeach(filename)
|
||||
|
||||
add_custom_target(${target_name} ALL
|
||||
DEPENDS ${dstfiles}
|
||||
|
|
|
|||
Loading…
Reference in New Issue