CMake: Don't use pzip when not built

This commit is contained in:
Sam Edwards 2018-05-31 20:25:27 -06:00
parent 7e4f9b4c8e
commit f54b4b61dd
2 changed files with 10 additions and 2 deletions

View File

@ -90,7 +90,7 @@ if(BUILD_MODELS)
DESTINATION "${PROJECT_BINARY_DIR}/models/maps"
)
run_pzip(models
"${CMAKE_CURRENT_SOURCE_DIR}/models"
"${CMAKE_CURRENT_SOURCE_DIR}/models/"
"${PROJECT_BINARY_DIR}/models"
*.egg
)
@ -99,7 +99,7 @@ if(BUILD_MODELS)
FILES_MATCHING PATTERN *.rgb PATTERN *.png PATTERN *.jpg PATTERN *.wav
)
run_pzip(dmodels
"${CMAKE_CURRENT_SOURCE_DIR}/dmodels/src"
"${CMAKE_CURRENT_SOURCE_DIR}/dmodels/src/"
"${PROJECT_BINARY_DIR}/models"
*.egg
)

View File

@ -1,4 +1,12 @@
function(run_pzip target_name source destination glob)
if(NOT TARGET pzip)
# If pzip isn't built, we just copy instead.
file(COPY "${source}"
DESTINATION "${destination}"
FILES_MATCHING PATTERN "${glob}")
return()
endif()
file(GLOB_RECURSE files RELATIVE "${source}" "${source}/${glob}")
set(dstfiles "")