diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2015-12-06 19:30:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-12-07 15:51:27 (GMT) |
commit | bc35087da3eb9039dad8fb5d27c1fab60b43f776 (patch) | |
tree | 3dd571955e4de96714ea37bde105f64155220ae8 /Source/cmcmd.cxx | |
parent | 98be140fc0dc0bab8955c4fea9274ea52ac8cd9c (diff) | |
download | CMake-bc35087da3eb9039dad8fb5d27c1fab60b43f776.zip CMake-bc35087da3eb9039dad8fb5d27c1fab60b43f776.tar.gz CMake-bc35087da3eb9039dad8fb5d27c1fab60b43f776.tar.bz2 |
cmake: Teach -E copy_directory to support multiple input directories
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r-- | Source/cmcmd.cxx | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c823201..6a4234f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -58,8 +58,8 @@ void CMakeCommandUsage(const char* program) << " compare_files file1 file2 - check if file1 is same as file2\n" << " copy <file>... destination - copy files to destination " "(either file or directory)\n" - << " copy_directory source destination - copy directory 'source' " - "content to directory 'destination'\n" + << " copy_directory <dir>... destination - copy content of <dir>... " + "directories to 'destination' directory\n" << " copy_if_different <file>... destination - copy files if it has " "changed\n" << " echo [<string>...] - displays arguments as text\n" @@ -206,16 +206,22 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } // Copy directory content - if (args[1] == "copy_directory" && args.size() == 4) + if (args[1] == "copy_directory" && args.size() > 3) { - if(!cmSystemTools::CopyADirectory(args[2], args[3])) + // If error occurs we want to continue copying next files. + bool return_value = 0; + for (std::string::size_type cc = 2; cc < args.size() - 1; cc ++) { - std::cerr << "Error copying directory from \"" - << args[2] << "\" to \"" << args[3] - << "\".\n"; - return 1; + if(!cmSystemTools::CopyADirectory(args[cc].c_str(), + args[args.size() - 1].c_str())) + { + std::cerr << "Error copying directory from \"" + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; + return_value = 1; + } } - return 0; + return return_value; } // Rename a file or directory |