ENH: better error reporting, and add NOTFOUND into cache for library and file find
This commit is contained in:
parent
3355878eeb
commit
2a7964e310
|
@ -29,8 +29,11 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args)
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
||||||
if(cacheValue )
|
if(cacheValue )
|
||||||
|
{
|
||||||
|
if(strcmp(cacheValue, "NOTFOUND") != 0)
|
||||||
{
|
{
|
||||||
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
|
@ -45,8 +48,8 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args)
|
||||||
|
|
||||||
// add the standard path
|
// add the standard path
|
||||||
cmSystemTools::GetPath(path);
|
cmSystemTools::GetPath(path);
|
||||||
|
unsigned int k;
|
||||||
for(unsigned int k=0; k < path.size(); k++)
|
for(k=0; k < path.size(); k++)
|
||||||
{
|
{
|
||||||
std::string tryPath = path[k];
|
std::string tryPath = path[k];
|
||||||
tryPath += "/";
|
tryPath += "/";
|
||||||
|
@ -61,6 +64,19 @@ bool cmFindIncludeCommand::Invoke(std::vector<std::string>& args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
||||||
|
"NOTFOUND",
|
||||||
|
cmCacheManager::PATH);
|
||||||
|
std::string message = "Include not found: ";
|
||||||
|
message += args[1];
|
||||||
|
message += "\n";
|
||||||
|
message += "looked in ";
|
||||||
|
for(k=0; k < path.size(); k++)
|
||||||
|
{
|
||||||
|
message += path[k];
|
||||||
|
message += "\n";
|
||||||
|
}
|
||||||
|
this->SetError(message.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,11 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args)
|
||||||
const char* cacheValue
|
const char* cacheValue
|
||||||
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
= cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str());
|
||||||
if(cacheValue)
|
if(cacheValue)
|
||||||
|
{
|
||||||
|
if(strcmp(cacheValue, "NOTFOUND") != 0)
|
||||||
{
|
{
|
||||||
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
m_Makefile->AddDefinition(args[0].c_str(), cacheValue);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
|
@ -45,8 +48,8 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args)
|
||||||
|
|
||||||
// add the standard path
|
// add the standard path
|
||||||
cmSystemTools::GetPath(path);
|
cmSystemTools::GetPath(path);
|
||||||
|
unsigned int k;
|
||||||
for(unsigned int k=0; k < path.size(); k++)
|
for(k=0; k < path.size(); k++)
|
||||||
{
|
{
|
||||||
std::string tryPath = path[k];
|
std::string tryPath = path[k];
|
||||||
tryPath += "/";
|
tryPath += "/";
|
||||||
|
@ -60,6 +63,19 @@ bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
|
||||||
|
"NOTFOUND",
|
||||||
|
cmCacheManager::PATH);
|
||||||
|
std::string message = "Library not found: ";
|
||||||
|
message += args[1];
|
||||||
|
message += "\n";
|
||||||
|
message += "looked in ";
|
||||||
|
for(k=0; k < path.size(); k++)
|
||||||
|
{
|
||||||
|
message += path[k];
|
||||||
|
message += "\n";
|
||||||
|
}
|
||||||
|
this->SetError(message.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,9 @@ bool cmMakefile::ReadListFile(const char* filename)
|
||||||
{
|
{
|
||||||
if(!usedCommand->Invoke(arguments))
|
if(!usedCommand->Invoke(arguments))
|
||||||
{
|
{
|
||||||
cmSystemTools::Error(usedCommand->GetError());
|
cmSystemTools::Error(usedCommand->GetName(),
|
||||||
|
": Error : \n",
|
||||||
|
usedCommand->GetError());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue