summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-09 19:30:35 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-09 19:30:35 (GMT)
commit4c5ba06fa13a2bc07f7e0a26bf455dc0b09d5e9c (patch)
tree36dd3cbb29d7773e102a0c58dee4ef3a5063c7c9 /Source/cmFileCommand.cxx
parentd253baab99663f531d91d406faf6fe2b822f5cb8 (diff)
downloadCMake-4c5ba06fa13a2bc07f7e0a26bf455dc0b09d5e9c.zip
CMake-4c5ba06fa13a2bc07f7e0a26bf455dc0b09d5e9c.tar.gz
CMake-4c5ba06fa13a2bc07f7e0a26bf455dc0b09d5e9c.tar.bz2
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
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 56f93eb..6c4ad5c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -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;
+}
+