>From 7b01d1aed22b16fd81c3ae47dd51311e9a15187a Mon Sep 17 00:00:00 2001 From: wonder-mice <wonder.m...@gmail.com> Date: Tue, 19 Jan 2016 18:13:10 -0800 Subject: [PATCH] Fix args handling in cmake -E time
Previous implementation had two issues: * Quotes in arguments where not escaped * No special treatment for arguments with spaces Because of that, following command line: cmake -E time cmake "-GUnix Makefile" was interpreted as cmake -E time cmake "-GUnix" "Makefile" Proposed patch fixes that by escaping all quotes in arguments and wrapping all arguments in quotes before concatenating them. --- Source/cmAlgorithms.h | 2 +- Source/cmcmd.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index ef607d2..5b76429 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -230,7 +230,7 @@ template<typename Range> std::string cmJoin(Range const& r, std::string delimiter) { return cmJoin(r, delimiter.c_str()); -}; +} template<typename Range> typename Range::const_iterator cmRemoveN(Range& r, size_t n) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index fb7b1f5..5643cb9 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -555,7 +555,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // Clock command else if (args[1] == "time" && args.size() > 2) { - std::string command = cmJoin(cmMakeRange(args).advance(2), " "); + std::string command = cmWrap('"', cmMakeRange(args).advance(2), '"', " "); clock_t clock_start, clock_finish; time_t time_start, time_finish; -- 2.5.4 (Apple Git-61)
0001-Fix-args-handling-in-cmake-E-time.patch
Description: Binary data
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers