diff options
author | Brad King <brad.king@kitware.com> | 2013-11-15 18:31:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-15 19:40:55 (GMT) |
commit | 0814d0a6559ed3634dafb372f34491407a27c5e8 (patch) | |
tree | 3d007775dc63f56ed46a30e02eb54d8c8ab4c356 /Source/cmSystemTools.cxx | |
parent | ee6e4ac841d8094b59cd0a48c61d7ca3b68c68c2 (diff) | |
download | CMake-0814d0a6559ed3634dafb372f34491407a27c5e8.zip CMake-0814d0a6559ed3634dafb372f34491407a27c5e8.tar.gz CMake-0814d0a6559ed3634dafb372f34491407a27c5e8.tar.bz2 |
cmSystemTools: Add PrintSingleCommand method
Add a method to print a command line for human reference by simply
double-quoting every argument.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 8a0d8dc..b3dbd05 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -795,6 +795,23 @@ bool cmSystemTools::RunSingleCommand( dir, outputflag, timeout); } +std::string +cmSystemTools::PrintSingleCommand(std::vector<std::string> const& command) +{ + std::string commandStr; + const char* sep = ""; + for(std::vector<std::string>::const_iterator i = command.begin(); + i != command.end(); ++i) + { + commandStr += sep; + commandStr += "\""; + commandStr += *i; + commandStr += "\""; + sep = " "; + } + return commandStr; +} + bool cmSystemTools::DoesFileExistWithExtensions( const char* name, const std::vector<std::string>& headerExts) |