summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2015-01-09 15:33:00 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-12 14:36:25 (GMT)
commitd811d238abe2dcd04cebd7ee4c3f07f4b6da093f (patch)
tree2ae34f0ac5f6a84452a359d36d22e5760791b557 /Source/cmSystemTools.cxx
parentdf16dcfb4478bb05932a1abb0e42433e60f1a565 (diff)
downloadCMake-d811d238abe2dcd04cebd7ee4c3f07f4b6da093f.zip
CMake-d811d238abe2dcd04cebd7ee4c3f07f4b6da093f.tar.gz
CMake-d811d238abe2dcd04cebd7ee4c3f07f4b6da093f.tar.bz2
cmSystemTools: use an enumeration for compression formats
Juggling 3 booleans was unwieldy.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx29
1 files changed, 20 insertions, 9 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index cd63347..963ca77 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1482,7 +1482,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<std::string>& files,
- bool gzip, bool bzip2, bool xz,
+ cmTarCompression compressType,
bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -1497,11 +1497,24 @@ bool cmSystemTools::CreateTar(const char* outFileName,
cmSystemTools::Error(e.c_str());
return false;
}
- cmArchiveWrite a(fout, (gzip? cmArchiveWrite::CompressGZip :
- (bzip2? cmArchiveWrite::CompressBZip2 :
- (xz? cmArchiveWrite::CompressXZ :
- cmArchiveWrite::CompressNone))),
- cmArchiveWrite::TypeTAR);
+ cmArchiveWrite::Compress compress = cmArchiveWrite::CompressNone;
+ switch (compressType)
+ {
+ case TarCompressGZip:
+ compress = cmArchiveWrite::CompressGZip;
+ break;
+ case TarCompressBZip2:
+ compress = cmArchiveWrite::CompressBZip2;
+ break;
+ case TarCompressXZ:
+ compress = cmArchiveWrite::CompressXZ;
+ break;
+ case TarCompressNone:
+ compress = cmArchiveWrite::CompressNone;
+ break;
+ }
+ cmArchiveWrite a(fout, compress,
+ cmArchiveWrite::TypeTAR);
a.SetVerbose(verbose);
for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
@@ -1526,7 +1539,6 @@ bool cmSystemTools::CreateTar(const char* outFileName,
#else
(void)outFileName;
(void)files;
- (void)gzip;
(void)verbose;
return false;
#endif
@@ -1787,7 +1799,7 @@ bool extract_tar(const char* outFileName, bool verbose,
#endif
bool cmSystemTools::ExtractTar(const char* outFileName,
- bool , bool verbose)
+ bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
return extract_tar(outFileName, verbose, true);
@@ -1799,7 +1811,6 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
}
bool cmSystemTools::ListTar(const char* outFileName,
- bool ,
bool verbose)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)