summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2001-05-03 14:35:15 (GMT)
committerKen Martin <ken.martin@kitware.com>2001-05-03 14:35:15 (GMT)
commit2e6ea303c0d0794d772c9bcfa0d08b8b228cacf1 (patch)
tree300943278d784d8c2a41fa6b9fe2fd45f4503e05 /Source
parent271391e148a11332bc2daed00b4200124cc0f103 (diff)
downloadCMake-2e6ea303c0d0794d772c9bcfa0d08b8b228cacf1.zip
CMake-2e6ea303c0d0794d772c9bcfa0d08b8b228cacf1.tar.gz
CMake-2e6ea303c0d0794d772c9bcfa0d08b8b228cacf1.tar.bz2
now support cmakedefine
Diffstat (limited to 'Source')
-rw-r--r--Source/cmConfigureFile.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmConfigureFile.cxx b/Source/cmConfigureFile.cxx
index 15392a4..a94d915 100644
--- a/Source/cmConfigureFile.cxx
+++ b/Source/cmConfigureFile.cxx
@@ -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";
}
}