summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-30 14:38:17 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-08-30 14:38:25 (GMT)
commita38965db9a515c0f8af9035d6cca13cf684b406a (patch)
tree2e30c7128deb1e0265405a6c50fc951f9e577f5b /Source
parentf8917685f32677c4055176d96bbd5a747da03fdb (diff)
parente6c9a8bac3a2f3103ee79058e92dadd2d30c8ac5 (diff)
downloadCMake-a38965db9a515c0f8af9035d6cca13cf684b406a.zip
CMake-a38965db9a515c0f8af9035d6cca13cf684b406a.tar.gz
CMake-a38965db9a515c0f8af9035d6cca13cf684b406a.tar.bz2
Merge topic 'remove_directory-symlink'
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3738
Diffstat (limited to 'Source')
-rw-r--r--Source/cmcmd.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 2be8bae..6cbe546 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -673,10 +673,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;