mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
ENH: add new commands fro find library and find program
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user