summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmIfCommand.cxx7
-rw-r--r--Source/cmMakefile.cxx26
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmVariableWatch.h1
4 files changed, 29 insertions, 7 deletions
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 2814f72..8faab58 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -307,17 +307,18 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
if (*arg == "DEFINED" && argP1 != newArgs.end())
{
size_t argP1len = argP1->size();
+ bool bdef = false;
if(argP1len > 4 && argP1->substr(0, 4) == "ENV{" &&
argP1->operator[](argP1len-1) == '}')
{
std::string env = argP1->substr(4, argP1len-5);
- def = cmSystemTools::GetEnv(env.c_str());
+ bdef = cmSystemTools::GetEnv(env.c_str())?true:false;
}
else
{
- def = makefile->GetDefinitionNoWatch((argP1)->c_str());
+ bdef = makefile->IsDefinitionSet((argP1)->c_str());
}
- if(def)
+ if(bdef)
{
*arg = "1";
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9f05114..f126d0e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1633,7 +1633,7 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const
return ret;
}
-const char* cmMakefile::GetDefinitionNoWatch(const char* name) const
+bool cmMakefile::IsDefinitionSet(const char* name) const
{
const char* def = 0;
DefinitionMap::const_iterator pos = this->Definitions.find(name);
@@ -1645,12 +1645,32 @@ const char* cmMakefile::GetDefinitionNoWatch(const char* name) const
{
def = this->GetCacheManager()->GetCacheValue(name);
}
- return def;
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ if(cmVariableWatch* vv = this->GetVariableWatch())
+ {
+ if(!def)
+ {
+ vv->VariableAccessed
+ (name, cmVariableWatch::UNKNOWN_VARIABLE_DEFINED_ACCESS,
+ def, this);
+ }
+ }
+#endif
+ return def?true:false;
}
const char* cmMakefile::GetDefinition(const char* name) const
{
- const char* def = this->GetDefinitionNoWatch(name);
+ const char* def = 0;
+ DefinitionMap::const_iterator pos = this->Definitions.find(name);
+ if(pos != this->Definitions.end())
+ {
+ def = (*pos).second.c_str();
+ }
+ else
+ {
+ def = this->GetCacheManager()->GetCacheValue(name);
+ }
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1ea866c..8f4d0ee 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -492,9 +492,9 @@ public:
* cache is then queried.
*/
const char* GetDefinition(const char*) const;
- const char* GetDefinitionNoWatch(const char*) const;
const char* GetSafeDefinition(const char*) const;
const char* GetRequiredDefinition(const char* name) const;
+ bool IsDefinitionSet(const char*) const;
/**
* Get the list of all variables in the current space. If argument
* cacheonly is specified and is greater than 0, then only cache
diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h
index 7f97c28..fc24d17 100644
--- a/Source/cmVariableWatch.h
+++ b/Source/cmVariableWatch.h
@@ -55,6 +55,7 @@ public:
{
VARIABLE_READ_ACCESS = 0,
UNKNOWN_VARIABLE_READ_ACCESS,
+ UNKNOWN_VARIABLE_DEFINED_ACCESS,
ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS,
VARIABLE_MODIFIED_ACCESS,
VARIABLE_REMOVED_ACCESS,