summaryrefslogtreecommitdiff
path: root/Source/cmOutputConverter.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-10-18 16:45:55 -0400
committerKyle Edwards <kyle.edwards@kitware.com>2021-10-27 13:27:02 -0400
commit447fbf061a5f27abbad59a9fc943de4f8351f9fe (patch)
tree43d6f4722b6c0599f3fdf35dca3bdbc43723e77b /Source/cmOutputConverter.cxx
parentaf6414c6c5e9767f0f997523af8fe1e5a71f6093 (diff)
downloadcmake-447fbf061a5f27abbad59a9fc943de4f8351f9fe.tar.gz
EscapeForCMake: Add wrapQuotes parameter
Diffstat (limited to 'Source/cmOutputConverter.cxx')
-rw-r--r--Source/cmOutputConverter.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index 2b785e1d3b..02b48216fc 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;
}