summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 0832e2f..fbbd47c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -676,10 +676,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
// If an error occurs, we want to continue removing directories.
bool return_value = false;
for (auto const& arg : cmMakeRange(args).advance(2)) {
- if (cmSystemTools::FileIsDirectory(arg) &&
- !cmSystemTools::RemoveADirectory(arg)) {
- std::cerr << "Error removing directory \"" << arg << "\".\n";
- return_value = true;
+ if (cmSystemTools::FileIsDirectory(arg)) {
+ if (cmSystemTools::FileIsSymlink(arg)) {
+ if (!cmSystemTools::RemoveFile(arg)) {
+ std::cerr << "Error removing directory symlink \"" << arg
+ << "\".\n";
+ return_value = true;
+ }
+ } else if (!cmSystemTools::RemoveADirectory(arg)) {
+ std::cerr << "Error removing directory \"" << arg << "\".\n";
+ return_value = true;
+ }
}
}
return return_value;