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.

This commit is contained in:
Brad King 2006-07-18 15:21:26 -04:00
parent 48571e9d80
commit ec637248da
5 changed files with 50 additions and 9 deletions

View File

@ -19,6 +19,7 @@
cmFindBase::cmFindBase() cmFindBase::cmFindBase()
{ {
this->AlreadyInCache = false; this->AlreadyInCache = false;
this->AlreadyInCacheWithoutMetaInfo = false;
this->NoDefaultPath = false; this->NoDefaultPath = false;
this->NoCMakePath = false; this->NoCMakePath = false;
this->NoCMakeEnvironmentPath = false; this->NoCMakeEnvironmentPath = false;
@ -674,18 +675,27 @@ void cmFindBase::PrintFindStuff()
bool cmFindBase::CheckForVariableInCache() bool cmFindBase::CheckForVariableInCache()
{ {
const char* cacheValue if(const char* cacheValue =
= this->Makefile->GetDefinition(this->VariableName.c_str()); this->Makefile->GetDefinition(this->VariableName.c_str()))
if(cacheValue && !cmSystemTools::IsNOTFOUND(cacheValue))
{
return true;
}
if(cacheValue)
{ {
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =
this->Makefile->GetCacheManager()-> this->Makefile->GetCacheManager()->
GetCacheIterator(this->VariableName.c_str()); 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"); const char* hs = it.GetProperty("HELPSTRING");
this->VariableDocumentation = hs?hs:"(none)"; this->VariableDocumentation = hs?hs:"(none)";

View File

@ -67,6 +67,7 @@ protected:
cmStdString EnvironmentPath; // LIB,INCLUDE cmStdString EnvironmentPath; // LIB,INCLUDE
bool AlreadyInCache; bool AlreadyInCache;
bool AlreadyInCacheWithoutMetaInfo;
bool NoDefaultPath; bool NoDefaultPath;
bool NoCMakePath; bool NoCMakePath;
bool NoCMakeEnvironmentPath; bool NoCMakeEnvironmentPath;

View File

@ -52,6 +52,15 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
} }
if(this->AlreadyInCache) 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; return true;
} }
// add special 64 bit paths if this is a 64 bit compile. // add special 64 bit paths if this is a 64 bit compile.

View File

@ -67,6 +67,18 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
} }
if(this->AlreadyInCache) 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; return true;
} }
std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK"); std::string ff = this->Makefile->GetSafeDefinition("CMAKE_FIND_FRAMEWORK");

View File

@ -51,6 +51,15 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
} }
if(this->AlreadyInCache) 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; return true;
} }