diff options
author | Brad King <brad.king@kitware.com> | 2015-12-09 13:36:56 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-12-09 13:36:56 (GMT) |
commit | dc873f6eef1e6f952cf3d09be7568b03fbf8c6d3 (patch) | |
tree | 71d1333fb6237bb40754833042be93b4d5336732 /Source | |
parent | ad1be6ee769ecaba4d6dadae84c0fc372049a333 (diff) | |
parent | bc35087da3eb9039dad8fb5d27c1fab60b43f776 (diff) | |
download | CMake-dc873f6eef1e6f952cf3d09be7568b03fbf8c6d3.zip CMake-dc873f6eef1e6f952cf3d09be7568b03fbf8c6d3.tar.gz CMake-dc873f6eef1e6f952cf3d09be7568b03fbf8c6d3.tar.bz2 |
Merge topic 'cmake-E-copy-multiple-inputs'
bc35087d cmake: Teach -E copy_directory to support multiple input directories
98be140f cmake: Refine -E copy[_if_different] documentation
93cc80ae cmake: Refine -E copy_if_different implementation indentation
0903812b cmake: Refine -E chdir documentation
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmcmd.cxx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 0dc5a9a..6a4234f 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -54,12 +54,12 @@ void CMakeCommandUsage(const char* program) errorStream << "Usage: " << program << " -E <command> [arguments...]\n" << "Available commands: \n" - << " chdir dir cmd [args]... - run command in a given directory\n" + << " chdir dir cmd [args...] - run command in a given directory\n" << " 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" @@ -197,8 +197,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) args[args.size() - 1].c_str())) { std::cerr << "Error copying file (if different) from \"" - << args[cc] << "\" to \"" << args[args.size() - 1] - << "\".\n"; + << args[cc] << "\" to \"" << args[args.size() - 1] + << "\".\n"; return_value = 1; } } @@ -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 |