summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-03-06 14:14:57 (GMT)
committerBrad King <brad.king@kitware.com>2009-03-06 14:14:57 (GMT)
commit2123b432d9806f8d3cebeeb897875f124f8c39c3 (patch)
tree7892489678625f6122e744a5e94890d5d28a394f /Source/cmFileCommand.cxx
parent73bea67fd3f9c0ea588c12206948e4630bf9e5d3 (diff)
downloadCMake-2123b432d9806f8d3cebeeb897875f124f8c39c3.zip
CMake-2123b432d9806f8d3cebeeb897875f124f8c39c3.tar.gz
CMake-2123b432d9806f8d3cebeeb897875f124f8c39c3.tar.bz2
ENH: Teach file(REMOVE) how to use relative paths
This teaches the command to interpret relative paths with respect to the location of the invoking CMakeLists.txt file. The convention is already used by most commands and won't change the behavior in script mode.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 78fc088..ab8edda 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2185,13 +2185,20 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
i++; // Get rid of subcommand
for(;i != args.end(); ++i)
{
- if(cmSystemTools::FileIsDirectory(i->c_str()) && recurse)
+ std::string fileName = *i;
+ if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str()))
{
- cmSystemTools::RemoveADirectory(i->c_str());
+ fileName = this->Makefile->GetCurrentDirectory();
+ fileName += "/" + *i;
+ }
+
+ if(cmSystemTools::FileIsDirectory(fileName.c_str()) && recurse)
+ {
+ cmSystemTools::RemoveADirectory(fileName.c_str());
}
else
{
- cmSystemTools::RemoveFile(i->c_str());
+ cmSystemTools::RemoveFile(fileName.c_str());
}
}
return true;