summaryrefslogtreecommitdiff
path: root/Source/cmOutputConverter.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-11-15 13:01:36 -0500
committerKyle Edwards <kyle.edwards@kitware.com>2019-12-13 10:51:46 -0500
commit5a8a9f72293ab1b3fd768ff40e5fb1f07cdb7dd2 (patch)
tree7e456292c9299223c3bd851261595f24371d2f3b /Source/cmOutputConverter.cxx
parent3bc63e99e44b3ef82c19d018f939ea839882a131 (diff)
downloadcmake-5a8a9f72293ab1b3fd768ff40e5fb1f07cdb7dd2.tar.gz
Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
Diffstat (limited to 'Source/cmOutputConverter.cxx')
-rw-r--r--Source/cmOutputConverter.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index e602a6d0ab..1c6fad1482 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -43,9 +43,10 @@ std::string cmOutputConverter::ConvertToOutputFormat(cm::string_view source,
{
std::string result(source);
// Convert it to an output path.
- if (output == SHELL || output == WATCOMQUOTE) {
+ if (output == SHELL || output == WATCOMQUOTE || output == NINJAMULTI) {
result = this->ConvertDirectorySeparatorsForShell(source);
- result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
+ result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE,
+ output == NINJAMULTI);
} else if (output == RESPONSE) {
result = this->EscapeForShell(result, false, false, false);
}
@@ -79,9 +80,9 @@ static bool cmOutputConverterIsShellOperator(cm::string_view str)
return (shellOperators.count(str) != 0);
}
-std::string cmOutputConverter::EscapeForShell(cm::string_view str,
- bool makeVars, bool forEcho,
- bool useWatcomQuote) const
+std::string cmOutputConverter::EscapeForShell(
+ cm::string_view str, bool makeVars, bool forEcho, bool useWatcomQuote,
+ bool unescapeNinjaConfiguration) const
{
// Do not escape shell operators.
if (cmOutputConverterIsShellOperator(str)) {
@@ -95,6 +96,9 @@ std::string cmOutputConverter::EscapeForShell(cm::string_view str,
} else if (!this->LinkScriptShell) {
flags |= Shell_Flag_Make;
}
+ if (unescapeNinjaConfiguration) {
+ flags |= Shell_Flag_UnescapeNinjaConfiguration;
+ }
if (makeVars) {
flags |= Shell_Flag_AllowMakeVariables;
}
@@ -511,5 +515,14 @@ std::string cmOutputConverter::Shell__GetArgument(cm::string_view in,
}
}
+ if (flags & Shell_Flag_UnescapeNinjaConfiguration) {
+ std::string ninjaConfigReplace;
+ if (flags & Shell_Flag_IsUnix) {
+ ninjaConfigReplace += '\\';
+ }
+ ninjaConfigReplace += "$${CONFIGURATION}";
+ cmSystemTools::ReplaceString(out, ninjaConfigReplace, "${CONFIGURATION}");
+ }
+
return out;
}