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:
Bill Hoffman
2006-03-09 14:30:35 -05:00
parent d253baab99
commit 4c5ba06fa1
7 changed files with 82 additions and 19 deletions
+32
View File
@@ -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;
}