summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-05-06 13:07:19 (GMT)
committerStephen Kelly <steveire@gmail.com>2012-06-04 21:42:37 (GMT)
commit2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac (patch)
tree331c3ab61eb7a5060f5495709bcaa2139c74d8e9 /Source/cmGlobalUnixMakefileGenerator3.cxx
parent1ccbfdebb99b167e1da1d9aa8a072adaea6325c6 (diff)
downloadCMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.zip
CMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.tar.gz
CMake-2c04bc00a4e38fc1b8f15bf950c8c2191ba24eac.tar.bz2
Move the EscapeJSON method to a sharable location.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx21
1 files changed, 6 insertions, 15 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index e63de9c..ebd8219 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -103,18 +103,6 @@ cmGlobalUnixMakefileGenerator3
}
}
-//----------------------------------------------------------------------------
-std::string EscapeJSON(const std::string& s) {
- std::string result;
- for (std::string::size_type i = 0; i < s.size(); ++i) {
- if (s[i] == '"' || s[i] == '\\') {
- result += '\\';
- }
- result += s[i];
- }
- return result;
-}
-
void cmGlobalUnixMakefileGenerator3::Generate()
{
// first do superclass method
@@ -179,11 +167,14 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand(
*this->CommandDatabase << "," << std::endl;
}
*this->CommandDatabase << "{" << std::endl
- << " \"directory\": \"" << EscapeJSON(workingDirectory) << "\","
+ << " \"directory\": \""
+ << cmGlobalGenerator::EscapeJSON(workingDirectory) << "\","
<< std::endl
- << " \"command\": \"" << EscapeJSON(compileCommand) << "\","
+ << " \"command\": \"" <<
+ cmGlobalGenerator::EscapeJSON(compileCommand) << "\","
<< std::endl
- << " \"file\": \"" << EscapeJSON(sourceFile) << "\""
+ << " \"file\": \"" <<
+ cmGlobalGenerator::EscapeJSON(sourceFile) << "\""
<< std::endl << "}";
}