|
|
@ -703,10 +703,20 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) |
|
|
|
// Tar files
|
|
|
|
else if (args[1] == "tar" && args.size() > 3) |
|
|
|
{ |
|
|
|
const char* knownFormats[] = |
|
|
|
{ |
|
|
|
"7zip", |
|
|
|
"gnutar", |
|
|
|
"pax", |
|
|
|
"paxr", |
|
|
|
"zip" |
|
|
|
}; |
|
|
|
|
|
|
|
std::string flags = args[2]; |
|
|
|
std::string outFile = args[3]; |
|
|
|
std::vector<std::string> files; |
|
|
|
std::string mtime; |
|
|
|
std::string format; |
|
|
|
bool doing_options = true; |
|
|
|
for (std::string::size_type cc = 4; cc < args.size(); cc ++) |
|
|
|
{ |
|
|
@ -729,6 +739,19 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (cmHasLiteralPrefix(arg, "--format=")) |
|
|
|
{ |
|
|
|
format = arg.substr(9); |
|
|
|
bool isKnown = std::find(cmArrayBegin(knownFormats), |
|
|
|
cmArrayEnd(knownFormats), format) != cmArrayEnd(knownFormats); |
|
|
|
|
|
|
|
if(!isKnown) |
|
|
|
{ |
|
|
|
cmSystemTools::Error("Unknown -E tar --format= argument: ", |
|
|
|
format.c_str()); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str()); |
|
|
@ -759,7 +782,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) |
|
|
|
compress = cmSystemTools::TarCompressGZip; |
|
|
|
++nCompress; |
|
|
|
} |
|
|
|
if ( nCompress > 1 ) |
|
|
|
if ( (format == "7zip" || format == "zip") && nCompress > 0 ) |
|
|
|
{ |
|
|
|
cmSystemTools::Error("Can not use compression flags with format: ", |
|
|
|
format.c_str()); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
else 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"); |
|
|
@ -781,7 +810,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) |
|
|
|
else if ( flags.find_first_of('c') != flags.npos ) |
|
|
|
{ |
|
|
|
if ( !cmSystemTools::CreateTar( |
|
|
|
outFile.c_str(), files, compress, verbose, mtime) ) |
|
|
|
outFile.c_str(), files, compress, verbose, mtime, format) ) |
|
|
|
{ |
|
|
|
cmSystemTools::Error("Problem creating tar: ", outFile.c_str()); |
|
|
|
return 1; |
|
|
|