summaryrefslogtreecommitdiffstats
path: root/Source/cmConfigureFileCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-03-27 17:24:30 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-03-27 17:24:30 (GMT)
commita9875aa62f41ed13b54ea9f92c65ade9f0df6845 (patch)
treeeac19ea62e63cd53b73a29144ed997e6e683ee63 /Source/cmConfigureFileCommand.cxx
parentb133b832fdcb50bc7bb9dc4bfb0631bb9aa6989e (diff)
downloadCMake-a9875aa62f41ed13b54ea9f92c65ade9f0df6845.zip
CMake-a9875aa62f41ed13b54ea9f92c65ade9f0df6845.tar.gz
CMake-a9875aa62f41ed13b54ea9f92c65ade9f0df6845.tar.bz2
Implement GetLineFromStream that actually works and use it instead of getline
Diffstat (limited to 'Source/cmConfigureFileCommand.cxx')
-rw-r--r--Source/cmConfigureFileCommand.cxx47
1 files changed, 20 insertions, 27 deletions
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index d34586d..e43fc15 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -105,49 +105,42 @@ void cmConfigureFileCommand::ConfigureFile()
// now copy input to output and expand variables in the
// input file at the same time
- const int bufSize = 4096;
- char buffer[bufSize];
std::string inLine;
cmRegularExpression cmdefine("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
- while(fin)
+ while( cmSystemTools::GetLineFromStream(fin, inLine) )
{
- fin.getline(buffer, bufSize);
- if(fin)
+ m_Makefile->ExpandVariablesInString(inLine, m_EscapeQuotes, m_AtOnly);
+ m_Makefile->RemoveVariablesInString(inLine, m_AtOnly);
+ // look for special cmakedefine symbol and handle it
+ // is the symbol defined
+ if (cmdefine.find(inLine))
{
- inLine = buffer;
- m_Makefile->ExpandVariablesInString(inLine, m_EscapeQuotes, m_AtOnly);
- m_Makefile->RemoveVariablesInString(inLine, m_AtOnly);
- // look for special cmakedefine symbol and handle it
- // is the symbol defined
- if (cmdefine.find(inLine))
+ const char *def = m_Makefile->GetDefinition(cmdefine.match(1).c_str());
+ if(!cmSystemTools::IsOff(def))
{
- const char *def = m_Makefile->GetDefinition(cmdefine.match(1).c_str());
- if(!cmSystemTools::IsOff(def))
- {
- cmSystemTools::ReplaceString(inLine,
- "#cmakedefine", "#define");
- fout << inLine << "\n";
- }
- else
- {
- cmSystemTools::ReplaceString(inLine,
- "#cmakedefine", "#undef");
- fout << "/* " << inLine << " */\n";
- }
+ cmSystemTools::ReplaceString(inLine,
+ "#cmakedefine", "#define");
+ fout << inLine << "\n";
}
else
{
- fout << inLine << "\n";
+ cmSystemTools::ReplaceString(inLine,
+ "#cmakedefine", "#undef");
+ fout << "/* " << inLine << " */\n";
}
}
+ else
+ {
+ fout << inLine << "\n";
+ }
}
// close the files before attempting to copy
fin.close();
fout.close();
cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
- m_OuputFile.c_str());
+ m_OuputFile.c_str());
cmSystemTools::RemoveFile(tempOutputFile.c_str());
}
}
-
+