mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
file(ARCHIVE_CREATE): add WORKING_DIRECTORY option
Fixes: #25260 Issue: #21653
This commit is contained in:
@@ -3607,6 +3607,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
|
||||
// accepted without one and treated as if an empty value were given.
|
||||
// Fixing this would require a policy.
|
||||
ArgumentParser::Maybe<std::string> MTime;
|
||||
std::string WorkingDirectory;
|
||||
bool Verbose = false;
|
||||
// "PATHS" requires at least one value, but use a custom check below.
|
||||
ArgumentParser::MaybeEmpty<std::vector<std::string>> Paths;
|
||||
@@ -3619,6 +3620,7 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
|
||||
.Bind("COMPRESSION"_s, &Arguments::Compression)
|
||||
.Bind("COMPRESSION_LEVEL"_s, &Arguments::CompressionLevel)
|
||||
.Bind("MTIME"_s, &Arguments::MTime)
|
||||
.Bind("WORKING_DIRECTORY"_s, &Arguments::WorkingDirectory)
|
||||
.Bind("VERBOSE"_s, &Arguments::Verbose)
|
||||
.Bind("PATHS"_s, &Arguments::Paths);
|
||||
|
||||
@@ -3718,7 +3720,8 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cmSystemTools::CreateTar(parsedArgs.Output, parsedArgs.Paths, compress,
|
||||
if (!cmSystemTools::CreateTar(parsedArgs.Output, parsedArgs.Paths,
|
||||
parsedArgs.WorkingDirectory, compress,
|
||||
parsedArgs.Verbose, parsedArgs.MTime,
|
||||
parsedArgs.Format, compressionLevel)) {
|
||||
status.SetError(cmStrCat("failed to compress: ", parsedArgs.Output));
|
||||
|
||||
Reference in New Issue
Block a user