summaryrefslogtreecommitdiffstats
path: root/Source/cmCacheManager.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-06-01 15:06:48 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-06-01 15:06:48 (GMT)
commit26a5a295eb231dc9fae9ea90f6cf28d3b4eecaa2 (patch)
tree6f971663fc515aa9429cd122dec93fe4fe861517 /Source/cmCacheManager.cxx
parent8cba2c55f94ae95274224dbebd917084085e5908 (diff)
downloadCMake-26a5a295eb231dc9fae9ea90f6cf28d3b4eecaa2.zip
CMake-26a5a295eb231dc9fae9ea90f6cf28d3b4eecaa2.tar.gz
CMake-26a5a295eb231dc9fae9ea90f6cf28d3b4eecaa2.tar.bz2
ENH: also handle comments for variables which contain newlines
Alex
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r--Source/cmCacheManager.cxx37
1 files changed, 20 insertions, 17 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index c656a3c..d6794aa 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -224,7 +224,15 @@ bool cmCacheManager::LoadCache(const char* path,
}
while(realbuffer[0] == '/' && realbuffer[1] == '/')
{
- e.Properties["HELPSTRING"] += &realbuffer[2];
+ if ((realbuffer[2] == '\\') && (realbuffer[3]=='n'))
+ {
+ e.Properties["HELPSTRING"] += "\n";
+ e.Properties["HELPSTRING"] += &realbuffer[4];
+ }
+ else
+ {
+ e.Properties["HELPSTRING"] += &realbuffer[2];
+ }
cmSystemTools::GetLineFromStream(fin, buffer);
realbuffer = buffer.c_str();
if(!fin)
@@ -657,27 +665,22 @@ void cmCacheManager::OutputHelpString(std::ofstream& fout,
}
std::string oneLine;
std::string::size_type pos = 0;
- std::string::size_type nextBreak = 60;
- bool done = false;
-
- while(!done)
+ for (std::string::size_type i=0; i<=end; i++)
{
- if(nextBreak >= end)
- {
- nextBreak = end;
- done = true;
- }
- else
+ if ((i==end)
+ || (helpString[i]=='\n')
+ || ((i-pos >= 60) && (helpString[i]==' ')))
{
- while(nextBreak < end && helpString[nextBreak] != ' ')
+ fout << "//";
+ if (helpString[pos] == '\n')
{
- nextBreak++;
+ pos++;
+ fout << "\\n";
}
+ oneLine = helpString.substr(pos, i - pos);
+ fout << oneLine.c_str() << "\n";
+ pos = i;
}
- oneLine = helpString.substr(pos, nextBreak - pos);
- fout << "//" << oneLine.c_str() << "\n";
- pos = nextBreak;
- nextBreak += 60;
}
}