Browse Source

CMake: Don't use pzip when not built

Sam Edwards 7 years ago
parent
commit
f54b4b61dd
2 changed files with 10 additions and 2 deletions
  1. 2 2
      CMakeLists.txt
  2. 8 0
      cmake/macros/RunPzip.cmake

+ 2 - 2
CMakeLists.txt

@@ -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
   )

+ 8 - 0
cmake/macros/RunPzip.cmake

@@ -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 "")