now support cmakedefine
This commit is contained in:
parent
271391e148
commit
2e6ea303c0
|
@ -85,6 +85,7 @@ void cmConfigureFile::FinalPass()
|
|||
const int bufSize = 4096;
|
||||
char buffer[bufSize];
|
||||
std::string inLine;
|
||||
cmRegularExpression cmdefine("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
|
||||
while(fin)
|
||||
{
|
||||
fin.getline(buffer, bufSize);
|
||||
|
@ -93,6 +94,22 @@ void cmConfigureFile::FinalPass()
|
|||
inLine = buffer;
|
||||
m_Makefile->ExpandVariablesInString(inLine);
|
||||
m_Makefile->RemoveVariablesInString(inLine);
|
||||
// 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))
|
||||
{
|
||||
cmSystemTools::ReplaceString(inLine,
|
||||
"#cmakedefine", "#define");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmSystemTools::ReplaceString(inLine,
|
||||
"#cmakedefine", "#undef");
|
||||
}
|
||||
}
|
||||
fout << inLine << "\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue