summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-01-03 21:40:51 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-01-03 21:40:51 (GMT)
commit2c73d2e0f3c5ab4da8ef78bd99309522c05349a0 (patch)
treefac80fa3d96669f88059ad5ca5fb847b9b1bad7b /Source
parentb08a151722ecb23383079f27389313f34ceba6cd (diff)
downloadCMake-2c73d2e0f3c5ab4da8ef78bd99309522c05349a0.zip
CMake-2c73d2e0f3c5ab4da8ef78bd99309522c05349a0.tar.gz
CMake-2c73d2e0f3c5ab4da8ef78bd99309522c05349a0.tar.bz2
ENH: add new cmakedefine01 feature from bug report 2603
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d47832e..2745905 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -74,7 +74,8 @@ cmMakefile::cmMakefile()
this->AddSourceGroup("Header Files", "\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddDefaultDefinitions();
- m_cmDefineRegex.compile("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
+ m_cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
+ m_cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
this->PreOrder = false;
}
@@ -2399,6 +2400,20 @@ void cmMakefile::ConfigureString(const std::string& input,
output += " */";
}
}
+ else if(m_cmDefine01Regex.find(line))
+ {
+ const char* def = this->GetDefinition(m_cmDefine01Regex.match(1).c_str());
+ cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define");
+ output += line;
+ if(!cmSystemTools::IsOff(def))
+ {
+ output += " 1";
+ }
+ else
+ {
+ output += " 0";
+ }
+ }
else
{
output += line;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index ab0c89a..dba2763 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -726,6 +726,7 @@ private:
DefinitionMap::key_type m_TemporaryDefinitionKey;
cmsys::RegularExpression m_cmDefineRegex;
+ cmsys::RegularExpression m_cmDefine01Regex;
std::map<cmStdString,cmStdString> m_Properties;