summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx33
1 files changed, 31 insertions, 2 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 9f2ea46..2ef04ef 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -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;