summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-04 12:34:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-06-04 12:37:04 (GMT)
commita7d2efc15b117e404aeaf952c762a96ba34787a3 (patch)
treecf93326b3d5b1f21a13b98513b5b4b1b70b20f43 /Source
parent36140d864e71ee3d61240da42df2318b01cfbced (diff)
parent07a80c70020e0e533db8d75d7fe7c4270cc25afb (diff)
downloadCMake-a7d2efc15b117e404aeaf952c762a96ba34787a3.zip
CMake-a7d2efc15b117e404aeaf952c762a96ba34787a3.tar.gz
CMake-a7d2efc15b117e404aeaf952c762a96ba34787a3.tar.bz2
Merge topic 'remove_directories'
07a80c7002 cmake: Teach -E remove_directory to remove multiple directories 013bee698e Tests: Add RunCMake.CommandLine make_directory test checks 3eb16de327 Tests: Fix RunCMake.CommandLine make_directory test name Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3411
Diffstat (limited to 'Source')
-rw-r--r--Source/cmcmd.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index f4ef45c..a983d30 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -103,7 +103,7 @@ void CMakeCommandUsage(const char* program)
<< " sha512sum <file>... - create SHA512 checksum of files\n"
<< " remove [-f] <file>... - remove the file(s), use -f to force "
"it\n"
- << " remove_directory dir - remove a directory and its contents\n"
+ << " remove_directory <dir>... - remove directories and their contents\n"
<< " rename oldname newname - rename a file or directory "
"(on one volume)\n"
<< " server - start cmake in server mode\n"
@@ -661,7 +661,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
#endif
if (args[1] == "make_directory" && args.size() > 2) {
- // If error occurs we want to continue copying next files.
+ // If an error occurs, we want to continue making directories.
bool return_value = false;
for (auto const& arg : cmMakeRange(args).advance(2)) {
if (!cmSystemTools::MakeDirectory(arg)) {
@@ -672,13 +672,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
return return_value;
}
- if (args[1] == "remove_directory" && args.size() == 3) {
- if (cmSystemTools::FileIsDirectory(args[2]) &&
- !cmSystemTools::RemoveADirectory(args[2])) {
- std::cerr << "Error removing directory \"" << args[2] << "\".\n";
- return 1;
+ if (args[1] == "remove_directory" && args.size() > 2) {
+ // 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;
+ }
}
- return 0;
+ return return_value;
}
// Remove file