summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2015-01-09 15:33:36 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-12 14:36:25 (GMT)
commit4035ef786de80d4d2fc27cd5f03c629702f54762 (patch)
treecf0518bb695780c3acf2be67bd4b51e15d08be27 /Source/cmcmd.cxx
parentd811d238abe2dcd04cebd7ee4c3f07f4b6da093f (diff)
downloadCMake-4035ef786de80d4d2fc27cd5f03c629702f54762.zip
CMake-4035ef786de80d4d2fc27cd5f03c629702f54762.tar.gz
CMake-4035ef786de80d4d2fc27cd5f03c629702f54762.tar.bz2
cmake -E tar: error out on multiple compression formats
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 91b9e94..27dd08b 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -736,17 +736,27 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmSystemTools::cmTarCompression compress =
cmSystemTools::TarCompressNone;
bool verbose = false;
+ int nCompress = 0;
if ( flags.find_first_of('j') != flags.npos )
{
compress = cmSystemTools::TarCompressBZip2;
+ ++nCompress;
}
if ( flags.find_first_of('J') != flags.npos )
{
compress = cmSystemTools::TarCompressXZ;
+ ++nCompress;
}
if ( flags.find_first_of('z') != flags.npos )
{
compress = cmSystemTools::TarCompressGZip;
+ ++nCompress;
+ }
+ if ( nCompress > 1 )
+ {
+ cmSystemTools::Error("Can only compress a tar file one way; "
+ "at most one flag of z, j, or J may be used");
+ return 1;
}
if ( flags.find_first_of('v') != flags.npos )
{