|
@@ -1,15 +1,23 @@
|
|
|
function(run_pzip target_name source destination glob)
|
|
function(run_pzip target_name source destination glob)
|
|
|
if(NOT TARGET host_pzip)
|
|
if(NOT TARGET host_pzip)
|
|
|
- # If pzip isn't built, we just copy instead.
|
|
|
|
|
- file(COPY "${source}"
|
|
|
|
|
- DESTINATION "${destination}"
|
|
|
|
|
- FILES_MATCHING PATTERN "${glob}")
|
|
|
|
|
-
|
|
|
|
|
- return()
|
|
|
|
|
|
|
+ if(CMAKE_CROSSCOMPILING AND NOT EXISTS "${HOST_BIN_DIR}/pzip")
|
|
|
|
|
+ # If pzip isn't built, we just copy instead.
|
|
|
|
|
+ file(COPY "${source}"
|
|
|
|
|
+ DESTINATION "${destination}"
|
|
|
|
|
+ FILES_MATCHING PATTERN "${glob}")
|
|
|
|
|
+
|
|
|
|
|
+ return()
|
|
|
|
|
+ endif()
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB_RECURSE files RELATIVE "${source}" "${source}/${glob}")
|
|
file(GLOB_RECURSE files RELATIVE "${source}" "${source}/${glob}")
|
|
|
|
|
|
|
|
|
|
+ if(CMAKE_CROSSCOMPILING)
|
|
|
|
|
+ set(pzip_executable ${HOST_BIN_DIR}/pzip)
|
|
|
|
|
+ else()
|
|
|
|
|
+ set(pzip_executable host_pzip)
|
|
|
|
|
+ endif()
|
|
|
|
|
+
|
|
|
set(dstfiles "")
|
|
set(dstfiles "")
|
|
|
foreach(filename ${files})
|
|
foreach(filename ${files})
|
|
|
string(REGEX REPLACE "^/" "" filename "${filename}")
|
|
string(REGEX REPLACE "^/" "" filename "${filename}")
|
|
@@ -21,8 +29,8 @@ function(run_pzip target_name source destination glob)
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT "${destination}/${dstfile}"
|
|
add_custom_command(OUTPUT "${destination}/${dstfile}"
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${dstdir}"
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${dstdir}"
|
|
|
- COMMAND host_pzip -c > "${destination}/${dstfile}" < "${source}/${filename}"
|
|
|
|
|
- DEPENDS host_pzip
|
|
|
|
|
|
|
+ COMMAND ${pzip_executable} -c > "${destination}/${dstfile}" < "${source}/${filename}"
|
|
|
|
|
+ DEPENDS ${pzip_executable}
|
|
|
COMMENT "")
|
|
COMMENT "")
|
|
|
|
|
|
|
|
endforeach(filename)
|
|
endforeach(filename)
|