diff options
author | Brad King <brad.king@kitware.com> | 2015-02-23 15:26:38 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-02-23 15:26:38 (GMT) |
commit | cc3611023d9d5ca9ad1eabe13dfb12577970e283 (patch) | |
tree | 0247df02d729ae3cb23100edaa8fb3353b4a9fd7 /Source/cmcmd.cxx | |
parent | 15c409f4674ad3a94cb03fae145ddcf0b233a4d0 (diff) | |
parent | bb9d71b4fee2cc4abf55e0dcbadf85c6cbe0d07d (diff) | |
download | CMake-cc3611023d9d5ca9ad1eabe13dfb12577970e283.zip CMake-cc3611023d9d5ca9ad1eabe13dfb12577970e283.tar.gz CMake-cc3611023d9d5ca9ad1eabe13dfb12577970e283.tar.bz2 |
Merge topic 'use-algorithms'
bb9d71b4 Replace loops with algorithms.
4afe6c26 cmAlgorithms: Add cmReverseRange adaptor.
a3a0a8c2 cmAlgorithms: Add cmFindNot algorithm.
8c74a41f cmRST: Replace two erase with a rotate and larger erase.
61fe1919 cmAlgorithms: Update concept requirement to FowardIterator
09d6125b cmAlgorithms: Move cmRotate out of 'implementation detail' namespace.
8ed6ecac cmRST: Move two algorithms beside each other.
dfe49c20 cmRST: Use std::min where appropriate.
21b0654a cmGlobalGenerator: Convert set insert algorithm to vector algorithms.
416df93a Convert some raw loops to cmWrap.
37b88d34 cmAlgorithms: Add cmWrap.
a2818093 Use cmJoin where possible.
76207b08 cmCacheManager: Replace loop with algorithm.
60c3bb73 cmGlobalGenerator: Replace loop with algorithm.
05fec779 cmTarget: Port loop to algorithm.
9c225767 cmGlobalGenerator: Replace set::insert algorithm with cmRemoveDuplicates.
...
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r-- | Source/cmcmd.cxx | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 6a7dc6e..7d67bd8 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -213,27 +213,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Echo string else if (args[1] == "echo" ) { - unsigned int cc; - const char* space = ""; - for ( cc = 2; cc < args.size(); cc ++ ) - { - std::cout << space << args[cc]; - space = " "; - } - std::cout << std::endl; + std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl; return 0; } // Echo string no new line else if (args[1] == "echo_append" ) { - unsigned int cc; - const char* space = ""; - for ( cc = 2; cc < args.size(); cc ++ ) - { - std::cout << space << args[cc]; - space = " "; - } + std::cout << cmJoin(cmRange(args).advance(2), " "); return 0; } @@ -463,9 +450,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) return 1; } - std::string command = "\""; - command += cmJoin(cmRange(args).advance(3), "\" \""); - command += "\""; + std::string command = cmWrap('"', cmRange(args).advance(3), '"', " "); int retval = 0; int timeout = 0; if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, &retval, @@ -1329,12 +1314,7 @@ bool cmcmd::RunCommand(const char* comment, if(verbose) { std::cout << comment << ":\n"; - for(std::vector<std::string>::iterator i = command.begin(); - i != command.end(); ++i) - { - std::cout << *i << " "; - } - std::cout << "\n"; + std::cout << cmJoin(command, " ") << "\n"; } std::string output; int retCode =0; |