mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
ENH: use a cmake script to do the clean step, this allows for large numbers of files to be removed without making the command line too long
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <cmsys/Directory.hxx>
|
||||
|
||||
// cmLibraryCommand
|
||||
bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
|
||||
@@ -54,6 +55,14 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
|
||||
{
|
||||
return this->HandleMakeDirectoryCommand(args);
|
||||
}
|
||||
else if ( subCommand == "REMOVE" )
|
||||
{
|
||||
return this->HandleRemove(args, false);
|
||||
}
|
||||
else if ( subCommand == "REMOVE_RECURSE" )
|
||||
{
|
||||
return this->HandleRemove(args, true);
|
||||
}
|
||||
else if ( subCommand == "INSTALL" )
|
||||
{
|
||||
return this->HandleInstallCommand(args);
|
||||
@@ -857,3 +866,26 @@ bool cmFileCommand::HandleRelativePathCommand(
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
|
||||
bool recurse)
|
||||
{
|
||||
|
||||
std::string message;
|
||||
std::vector<std::string>::const_iterator i = args.begin();
|
||||
|
||||
i++; // Get rid of subcommand
|
||||
for(;i != args.end(); ++i)
|
||||
{
|
||||
if(cmSystemTools::FileIsDirectory(i->c_str()) && recurse)
|
||||
{
|
||||
cmSystemTools::RemoveADirectory(i->c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
cmSystemTools::RemoveFile(i->c_str());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user