summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-02-18 19:04:55 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2012-02-18 20:33:39 (GMT)
commit9362440a0b9193c417b42c50495d0a3ea6e098c4 (patch)
tree8b386a654be4788935d9e0fb560d77d466225dff
parent99856d537c996544bf495f33e6b058d83af4c6b7 (diff)
downloadCMake-9362440a0b9193c417b42c50495d0a3ea6e098c4.zip
CMake-9362440a0b9193c417b42c50495d0a3ea6e098c4.tar.gz
CMake-9362440a0b9193c417b42c50495d0a3ea6e098c4.tar.bz2
Ninja: Identifier encoding rules for ' ' and ':'
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7ff33ba..e9264ec 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -56,7 +56,8 @@ static bool IsIdentChar(char c)
('a' <= c && c <= 'z') ||
('+' <= c && c <= '9') || // +,-./ and numbers
('A' <= c && c <= 'Z') ||
- (c == '_') || (c == '$') || (c == '\\');
+ (c == '_') || (c == '$') || (c == '\\') ||
+ (c == ' ') || (c == ':');
}
std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
@@ -69,7 +70,10 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
vars << names.str() << " = " << ident << "\n";
return "$" + names.str();
} else {
- return ident;
+ std::string result = ident;
+ cmSystemTools::ReplaceString(result, " ", "$ ");
+ cmSystemTools::ReplaceString(result, ":", "$:");
+ return result;
}
}