ENH: add new commands fro find library and find program

This commit is contained in:
Ken Martin
2001-02-16 11:34:23 -05:00
parent fce56c57c4
commit 43859e36cf
11 changed files with 119 additions and 60 deletions

View File

@@ -18,16 +18,35 @@
// cmFindLibraryCommand
bool cmFindLibraryCommand::Invoke(std::vector<std::string>& args)
{
return false;
if(args.size() < 1 )
if(args.size() < 2 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
std::vector<std::string> path;
// add any user specified paths
for (int j = 2; j < args.size(); j++)
{
m_Makefile->AddDefineFlag((*i).c_str());
// expand variables
std::string exp = args[j];
m_Makefile->ExpandVariablesInString(exp);
path.push_back(exp);
}
// add the standard path
cmSystemTools::GetPath(path);
for(int k=0; k < path.size(); k++)
{
std::string tryPath = path[k];
tryPath += "/";
tryPath += args[1];
if(cmSystemTools::FileExists(tryPath.c_str()))
{
m_Makefile->AddDefinition(args[0].c_str(), path[k].c_str());
return true;
}
}
}