Przeglądaj źródła

Add XZ compress support to libarchive-wrapper

This is not needed but it does not cost much to do it for all
potentially supported format in libarchive. XZ and LZMA are not
builtin libarchive and require external lib but if
CMAKE_USE_SYSTEM_LIBARCHIVE is ON then we may get it for free.
Eric NOULARD 15 lat temu
rodzic
commit
1a3ad5c615
2 zmienionych plików z 10 dodań i 1 usunięć
  1. 8 0
      Source/cmArchiveWrite.cxx
  2. 2 1
      Source/cmArchiveWrite.h

+ 8 - 0
Source/cmArchiveWrite.cxx

@@ -87,6 +87,14 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, Type t):
         return;
         return;
         }
         }
       break;
       break;
+    case CompressXZ:
+      if(archive_write_set_compression_xz(this->Archive) != ARCHIVE_OK)
+        {
+        this->Error = "archive_write_set_compression_xz: ";
+        this->Error += archive_error_string(this->Archive);
+        return;
+        }
+      break;
     };
     };
 #if !defined(_WIN32) || defined(__CYGWIN__)
 #if !defined(_WIN32) || defined(__CYGWIN__)
   if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK)
   if (archive_read_disk_set_standard_lookup(this->Disk) != ARCHIVE_OK)

+ 2 - 1
Source/cmArchiveWrite.h

@@ -33,7 +33,8 @@ public:
     CompressNone,
     CompressNone,
     CompressGZip,
     CompressGZip,
     CompressBZip2,
     CompressBZip2,
-    CompressLZMA
+    CompressLZMA,
+    CompressXZ
   };
   };
 
 
   /** Archive Type */
   /** Archive Type */