cmake -E tar: error out on multiple compression formats
This commit is contained in:
parent
d811d238ab
commit
4035ef786d
|
@ -736,17 +736,27 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||||
cmSystemTools::cmTarCompression compress =
|
cmSystemTools::cmTarCompression compress =
|
||||||
cmSystemTools::TarCompressNone;
|
cmSystemTools::TarCompressNone;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
int nCompress = 0;
|
||||||
if ( flags.find_first_of('j') != flags.npos )
|
if ( flags.find_first_of('j') != flags.npos )
|
||||||
{
|
{
|
||||||
compress = cmSystemTools::TarCompressBZip2;
|
compress = cmSystemTools::TarCompressBZip2;
|
||||||
|
++nCompress;
|
||||||
}
|
}
|
||||||
if ( flags.find_first_of('J') != flags.npos )
|
if ( flags.find_first_of('J') != flags.npos )
|
||||||
{
|
{
|
||||||
compress = cmSystemTools::TarCompressXZ;
|
compress = cmSystemTools::TarCompressXZ;
|
||||||
|
++nCompress;
|
||||||
}
|
}
|
||||||
if ( flags.find_first_of('z') != flags.npos )
|
if ( flags.find_first_of('z') != flags.npos )
|
||||||
{
|
{
|
||||||
compress = cmSystemTools::TarCompressGZip;
|
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 )
|
if ( flags.find_first_of('v') != flags.npos )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue