diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-10-18 20:45:55 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-10-27 17:27:02 (GMT) |
commit | 447fbf061a5f27abbad59a9fc943de4f8351f9fe (patch) | |
tree | 43d6f4722b6c0599f3fdf35dca3bdbc43723e77b /Source/cmOutputConverter.cxx | |
parent | af6414c6c5e9767f0f997523af8fe1e5a71f6093 (diff) | |
download | CMake-447fbf061a5f27abbad59a9fc943de4f8351f9fe.zip CMake-447fbf061a5f27abbad59a9fc943de4f8351f9fe.tar.gz CMake-447fbf061a5f27abbad59a9fc943de4f8351f9fe.tar.bz2 |
EscapeForCMake: Add wrapQuotes parameter
Diffstat (limited to 'Source/cmOutputConverter.cxx')
-rw-r--r-- | Source/cmOutputConverter.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 2b785e1..02b4821 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -219,10 +219,11 @@ std::string cmOutputConverter::EscapeForShell( return Shell_GetArgument(str, flags); } -std::string cmOutputConverter::EscapeForCMake(cm::string_view str) +std::string cmOutputConverter::EscapeForCMake(cm::string_view str, + WrapQuotes wrapQuotes) { // Always double-quote the argument to take care of most escapes. - std::string result = "\""; + std::string result = (wrapQuotes == WrapQuotes::Wrap) ? "\"" : ""; for (const char c : str) { if (c == '"') { // Escape the double quote to avoid ending the argument. @@ -238,7 +239,9 @@ std::string cmOutputConverter::EscapeForCMake(cm::string_view str) result += c; } } - result += "\""; + if (wrapQuotes == WrapQuotes::Wrap) { + result += "\""; + } return result; } |