summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-07-18 19:21:26 (GMT)
committerBrad King <brad.king@kitware.com>2006-07-18 19:21:26 (GMT)
commitec637248da517e9e1f60775f95a6d8974f6c5071 (patch)
treeb4a90053f3b3690330d51af417bc6efe00fe0719
parent48571e9d802c137470711fa39477e1c439a93d72 (diff)
downloadCMake-ec637248da517e9e1f60775f95a6d8974f6c5071.zip
CMake-ec637248da517e9e1f60775f95a6d8974f6c5071.tar.gz
CMake-ec637248da517e9e1f60775f95a6d8974f6c5071.tar.bz2
BUG: If the user specifies a cache entry on the command line without a type, the FIND_* commands should add the type and docstring to the given value and put it back in the cache.
-rw-r--r--Source/cmFindBase.cxx28
-rw-r--r--Source/cmFindBase.h1
-rw-r--r--Source/cmFindLibraryCommand.cxx9
-rw-r--r--Source/cmFindPathCommand.cxx12
-rw-r--r--Source/cmFindProgramCommand.cxx9
5 files changed, 50 insertions, 9 deletions
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index e2fc963..fec625e 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -19,6 +19,7 @@
cmFindBase::cmFindBase()
{
this->AlreadyInCache = false;
+ this->AlreadyInCacheWithoutMetaInfo = false;
this->NoDefaultPath = false;
this->NoCMakePath = false;
this->NoCMakeEnvironmentPath = false;
@@ -674,18 +675,27 @@ void cmFindBase::PrintFindStuff()
bool cmFindBase::CheckForVariableInCache()
{
- const char* cacheValue
- = this->Makefile->GetDefinition(this->VariableName.c_str());
- if(cacheValue && !cmSystemTools::IsNOTFOUND(cacheValue))
+ if(const char* cacheValue =
+ this->Makefile->GetDefinition(this->VariableName.c_str()))
{
- return true;
- }
- if(cacheValue)
- {
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->Makefile->GetCacheManager()->
GetCacheIterator(this->VariableName.c_str());
- if(!it.IsAtEnd())
+ bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
+ bool cached = !it.IsAtEnd();
+ if(found)
+ {
+ // If the user specifies the entry on the command line without a
+ // type we should add the type and docstring but keep the
+ // original value. Tell the subclass implementations to do
+ // this.
+ if(cached && it.GetType() == cmCacheManager::UNINITIALIZED)
+ {
+ this->AlreadyInCacheWithoutMetaInfo = true;
+ }
+ return true;
+ }
+ else if(cached)
{
const char* hs = it.GetProperty("HELPSTRING");
this->VariableDocumentation = hs?hs:"(none)";
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 60c8853..e7084a4 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -67,6 +67,7 @@ protected:
cmStdString EnvironmentPath; // LIB,INCLUDE
bool AlreadyInCache;
+ bool AlreadyInCacheWithoutMetaInfo;
bool NoDefaultPath;
bool NoCMakePath;
bool NoCMakeEnvironmentPath;
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 1cac120..24d5b04 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -52,6 +52,15 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
}
if(this->AlreadyInCache)
{
+ // If the user specifies the entry on the command line without a
+ // type we should add the type and docstring but keep the original
+ // value.
+ if(this->AlreadyInCacheWithoutMetaInfo)
+ {
+ this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "",
+ this->VariableDocumentation.c_str(),
+ cmCacheManager::FILEPATH);
+ }
return true;
}
// add special 64 bit paths if this is a 64 bit compile.
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index 05ac43c..486fb53 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -67,6 +67,18 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
}
if(this->AlreadyInCache)
{
+ // If the user specifies the entry on the command line without a
+ // type we should add the type and docstring but keep the original
+ // value.
+ if(this->AlreadyInCacheWithoutMetaInfo)
+ {
+ this->Makefile->AddCacheDefinition(
+ this->VariableName.c_str(), "",
+ this->VariableDocumentation.c_str(),
+ (this->IncludeFileInPath ?
+ cmCacheManager::FILEPATH :cmCacheManager::PATH)
+ );
+ }
return true;
}
std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK");
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 475d3be..47bae5d 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -51,6 +51,15 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
}
if(this->AlreadyInCache)
{
+ // If the user specifies the entry on the command line without a
+ // type we should add the type and docstring but keep the original
+ // value.
+ if(this->AlreadyInCacheWithoutMetaInfo)
+ {
+ this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "",
+ this->VariableDocumentation.c_str(),
+ cmCacheManager::FILEPATH);
+ }
return true;
}