2003-01-21 22:15:22 +00:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
2004-04-26 14:49:34 +00:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
2003-01-21 22:15:22 +00:00
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
|
|
|
#include "cmFindPackageCommand.h"
|
2003-07-16 18:52:51 +00:00
|
|
|
#include <cmsys/RegularExpression.hxx>
|
2003-01-21 22:15:22 +00:00
|
|
|
|
2004-10-27 14:47:14 +00:00
|
|
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
2003-08-07 20:50:38 +00:00
|
|
|
#include "cmVariableWatch.h"
|
2004-10-27 14:47:14 +00:00
|
|
|
#endif
|
2003-08-07 20:50:38 +00:00
|
|
|
|
2004-04-26 14:49:34 +00:00
|
|
|
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
|
2007-04-11 19:13:05 +00:00
|
|
|
int access_type, void*, const char* newValue,
|
|
|
|
const cmMakefile*)
|
2003-08-07 20:50:38 +00:00
|
|
|
{
|
2007-04-11 19:13:05 +00:00
|
|
|
(void)newValue;
|
2004-10-27 14:47:14 +00:00
|
|
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
2003-08-07 20:50:38 +00:00
|
|
|
if(access_type == cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS)
|
|
|
|
{
|
|
|
|
std::string message = "An attempt was made to access a variable: ";
|
|
|
|
message += variable;
|
|
|
|
message +=
|
|
|
|
" that has not been defined. This variable is created by the "
|
|
|
|
"FIND_PACKAGE command. CMake version 1.6 always converted the "
|
|
|
|
"variable name to upper-case, but this behavior is no longer the "
|
|
|
|
"case. To fix this you might need to set the cache value of "
|
|
|
|
"CMAKE_BACKWARDS_COMPATIBILITY to 1.6 or less. If you are writing a "
|
|
|
|
"CMake listfile, you should change the variable reference to use "
|
|
|
|
"the case of the argument to FIND_PACKAGE.";
|
|
|
|
cmSystemTools::Error(message.c_str());
|
|
|
|
}
|
2004-10-27 14:47:14 +00:00
|
|
|
#else
|
|
|
|
(void)variable;
|
|
|
|
(void)access_type;
|
|
|
|
#endif
|
2003-08-07 20:50:38 +00:00
|
|
|
}
|
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
|
|
|
|
{
|
|
|
|
if(args.size() < 1)
|
|
|
|
{
|
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2006-10-26 15:39:56 +00:00
|
|
|
// Record options.
|
2003-01-21 22:15:22 +00:00
|
|
|
this->Name = args[0];
|
2003-07-16 18:52:51 +00:00
|
|
|
bool quiet = false;
|
2004-04-19 14:36:42 +00:00
|
|
|
bool required = false;
|
2006-10-26 15:39:56 +00:00
|
|
|
bool no_module = false;
|
|
|
|
std::string components;
|
|
|
|
const char* components_sep = "";
|
|
|
|
|
|
|
|
// Parse the arguments.
|
|
|
|
bool doing_components = false;
|
|
|
|
cmsys::RegularExpression version("^[0-9.]+$");
|
|
|
|
bool haveVersion = false;
|
|
|
|
for(unsigned int i=1; i < args.size(); ++i)
|
2003-07-16 18:52:51 +00:00
|
|
|
{
|
2006-10-26 15:39:56 +00:00
|
|
|
if(args[i] == "QUIET")
|
2003-07-16 18:52:51 +00:00
|
|
|
{
|
2006-10-26 15:39:56 +00:00
|
|
|
quiet = true;
|
|
|
|
doing_components = false;
|
|
|
|
}
|
|
|
|
else if(args[i] == "NO_MODULE")
|
|
|
|
{
|
|
|
|
no_module = true;
|
|
|
|
doing_components = false;
|
|
|
|
}
|
|
|
|
else if(args[i] == "REQUIRED")
|
|
|
|
{
|
|
|
|
required = true;
|
|
|
|
doing_components = true;
|
|
|
|
}
|
|
|
|
else if(args[i] == "COMPONENTS")
|
|
|
|
{
|
|
|
|
doing_components = true;
|
2003-07-16 18:52:51 +00:00
|
|
|
}
|
2006-10-26 15:39:56 +00:00
|
|
|
else if(doing_components)
|
|
|
|
{
|
|
|
|
// Set a variable telling the find script this component
|
|
|
|
// is required.
|
|
|
|
std::string req_var = Name + "_FIND_REQUIRED_" + args[i];
|
|
|
|
this->Makefile->AddDefinition(req_var.c_str(), "1");
|
2006-07-11 21:10:00 +00:00
|
|
|
|
2006-10-26 15:39:56 +00:00
|
|
|
// Append to the list of required components.
|
|
|
|
components += components_sep;
|
|
|
|
components += args[i];
|
|
|
|
components_sep = ";";
|
|
|
|
}
|
|
|
|
else if(!haveVersion && version.find(args[i].c_str()))
|
|
|
|
{
|
|
|
|
haveVersion = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmOStringStream e;
|
|
|
|
e << "called with invalid argument \"" << args[i].c_str() << "\"";
|
|
|
|
this->SetError(e.str().c_str());
|
|
|
|
return false;
|
|
|
|
}
|
2003-07-16 18:52:51 +00:00
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2006-10-26 15:39:56 +00:00
|
|
|
// Store the list of components.
|
|
|
|
std::string components_var = Name + "_FIND_COMPONENTS";
|
|
|
|
this->Makefile->AddDefinition(components_var.c_str(), components.c_str());
|
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// See if there is a Find<name>.cmake module.
|
2006-10-26 15:39:56 +00:00
|
|
|
if(!no_module)
|
2003-01-21 22:15:22 +00:00
|
|
|
{
|
2006-10-26 15:39:56 +00:00
|
|
|
bool foundModule = false;
|
|
|
|
if(!this->FindModule(foundModule, quiet, required))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(foundModule)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2003-01-21 22:15:22 +00:00
|
|
|
}
|
2003-08-07 20:50:38 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// No find module. Assume the project has a CMake config file. Use
|
2004-04-26 14:49:34 +00:00
|
|
|
// a <NAME>_DIR cache variable to locate it.
|
2003-07-16 18:52:51 +00:00
|
|
|
this->Variable = this->Name;
|
2003-01-21 22:15:22 +00:00
|
|
|
this->Variable += "_DIR";
|
|
|
|
this->Config = this->Name;
|
|
|
|
this->Config += "Config.cmake";
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-08-07 20:50:38 +00:00
|
|
|
// Support old capitalization behavior.
|
|
|
|
std::string upperDir = cmSystemTools::UpperCase(this->Name);
|
|
|
|
std::string upperFound = cmSystemTools::UpperCase(this->Name);
|
|
|
|
upperDir += "_DIR";
|
|
|
|
upperFound += "_FOUND";
|
|
|
|
bool needCompatibility = false;
|
2003-08-08 13:14:33 +00:00
|
|
|
if(!(upperDir == this->Variable))
|
2003-08-07 20:50:38 +00:00
|
|
|
{
|
|
|
|
const char* versionValue =
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
|
2003-08-07 20:50:38 +00:00
|
|
|
if(atof(versionValue) < 1.7)
|
|
|
|
{
|
|
|
|
needCompatibility = true;
|
|
|
|
}
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-08-07 20:50:38 +00:00
|
|
|
// Try to find the config file.
|
2006-03-15 16:02:08 +00:00
|
|
|
const char* def = this->Makefile->GetDefinition(this->Variable.c_str());
|
2003-08-07 20:50:38 +00:00
|
|
|
if(needCompatibility && cmSystemTools::IsOff(def))
|
|
|
|
{
|
|
|
|
// Use the setting of the old name of the variable to provide the
|
|
|
|
// value of the new.
|
2006-03-15 16:02:08 +00:00
|
|
|
const char* oldDef = this->Makefile->GetDefinition(upperDir.c_str());
|
2003-08-07 20:50:38 +00:00
|
|
|
if(!cmSystemTools::IsOff(oldDef))
|
|
|
|
{
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->AddDefinition(this->Variable.c_str(), oldDef);
|
|
|
|
def = this->Makefile->GetDefinition(this->Variable.c_str());
|
2003-08-07 20:50:38 +00:00
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
}
|
2003-01-21 22:15:22 +00:00
|
|
|
if(cmSystemTools::IsOff(def))
|
|
|
|
{
|
|
|
|
if(!this->FindConfig())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// If the config file was found, load it.
|
|
|
|
bool result = true;
|
|
|
|
bool found = false;
|
2006-03-15 16:02:08 +00:00
|
|
|
def = this->Makefile->GetDefinition(this->Variable.c_str());
|
2003-01-21 22:15:22 +00:00
|
|
|
if(!cmSystemTools::IsOff(def))
|
|
|
|
{
|
|
|
|
std::string f = def;
|
|
|
|
f += "/";
|
|
|
|
f += this->Config;
|
|
|
|
if(cmSystemTools::FileExists(f.c_str()))
|
|
|
|
{
|
|
|
|
if(this->ReadListFile(f.c_str()))
|
|
|
|
{
|
|
|
|
found = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmOStringStream e;
|
|
|
|
e << this->Variable << " is set to \"" << def << "\", which is "
|
|
|
|
<< "not a directory containing " << this->Config;
|
|
|
|
cmSystemTools::Error(e.str().c_str());
|
2004-04-19 14:36:42 +00:00
|
|
|
if(required)
|
|
|
|
{
|
|
|
|
cmSystemTools::SetFatalErrorOccured();
|
|
|
|
}
|
2003-01-21 22:15:22 +00:00
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
}
|
2004-04-19 14:36:42 +00:00
|
|
|
else if(!quiet || required)
|
2003-01-21 22:15:22 +00:00
|
|
|
{
|
|
|
|
cmOStringStream e;
|
|
|
|
e << this->Variable << " is not set. It must be set to the directory "
|
2004-01-05 20:30:49 +00:00
|
|
|
<< "containing " << this->Config << " in order to use "
|
2003-01-21 22:15:22 +00:00
|
|
|
<< this->Name << ".";
|
|
|
|
cmSystemTools::Error(e.str().c_str());
|
2004-04-19 14:36:42 +00:00
|
|
|
if(required)
|
|
|
|
{
|
|
|
|
cmSystemTools::SetFatalErrorOccured();
|
|
|
|
}
|
2003-01-21 22:15:22 +00:00
|
|
|
result = true;
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-08-07 20:50:38 +00:00
|
|
|
// Set a variable marking whether the package was found.
|
2003-07-16 18:52:51 +00:00
|
|
|
std::string foundVar = this->Name;
|
2004-04-26 14:49:34 +00:00
|
|
|
foundVar += "_FOUND";
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->AddDefinition(foundVar.c_str(), found? "1":"0");
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-08-07 20:50:38 +00:00
|
|
|
if(needCompatibility)
|
|
|
|
{
|
|
|
|
// Listfiles will be looking for the capitalized version of the
|
|
|
|
// name. Provide it.
|
2006-05-10 19:46:45 +00:00
|
|
|
this->Makefile->AddDefinition
|
|
|
|
(upperDir.c_str(),
|
|
|
|
this->Makefile->GetDefinition(this->Variable.c_str()));
|
|
|
|
this->Makefile->AddDefinition
|
|
|
|
(upperFound.c_str(),
|
|
|
|
this->Makefile->GetDefinition(foundVar.c_str()));
|
2003-08-07 20:50:38 +00:00
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2004-10-27 14:47:14 +00:00
|
|
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
2003-08-08 13:14:33 +00:00
|
|
|
if(!(upperDir == this->Variable))
|
2003-08-07 20:50:38 +00:00
|
|
|
{
|
|
|
|
if(needCompatibility)
|
|
|
|
{
|
|
|
|
// Listfiles may use the capitalized version of the name.
|
|
|
|
// Remove any previously added watch.
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->GetVariableWatch()->RemoveWatch(
|
2003-08-07 20:50:38 +00:00
|
|
|
upperDir.c_str(),
|
|
|
|
cmFindPackageNeedBackwardsCompatibility
|
|
|
|
);
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->GetVariableWatch()->RemoveWatch(
|
2003-08-07 20:50:38 +00:00
|
|
|
upperFound.c_str(),
|
|
|
|
cmFindPackageNeedBackwardsCompatibility
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Listfiles should not be using the capitalized version of the
|
|
|
|
// name. Add a watch to warn the user.
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->GetVariableWatch()->AddWatch(
|
2003-08-07 20:50:38 +00:00
|
|
|
upperDir.c_str(),
|
|
|
|
cmFindPackageNeedBackwardsCompatibility
|
|
|
|
);
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->GetVariableWatch()->AddWatch(
|
2003-08-07 20:50:38 +00:00
|
|
|
upperFound.c_str(),
|
|
|
|
cmFindPackageNeedBackwardsCompatibility
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2004-10-27 14:47:14 +00:00
|
|
|
#endif
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2004-04-19 14:36:42 +00:00
|
|
|
bool cmFindPackageCommand::FindModule(bool& found, bool quiet, bool required)
|
2003-01-21 22:15:22 +00:00
|
|
|
{
|
2004-03-28 00:52:11 +00:00
|
|
|
std::string module = "Find";
|
2004-02-28 23:59:19 +00:00
|
|
|
module += this->Name;
|
|
|
|
module += ".cmake";
|
2006-03-15 16:02:08 +00:00
|
|
|
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
|
2004-02-28 23:59:19 +00:00
|
|
|
if ( mfile.size() )
|
2003-01-21 22:15:22 +00:00
|
|
|
{
|
2004-02-28 23:59:19 +00:00
|
|
|
if(quiet)
|
2003-01-22 15:40:48 +00:00
|
|
|
{
|
2004-02-28 23:59:19 +00:00
|
|
|
// Tell the module that is about to be read that it should find
|
|
|
|
// quietly.
|
|
|
|
std::string quietly = this->Name;
|
|
|
|
quietly += "_FIND_QUIETLY";
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->AddDefinition(quietly.c_str(), "1");
|
2003-01-22 15:40:48 +00:00
|
|
|
}
|
2004-02-28 23:59:19 +00:00
|
|
|
|
2004-04-19 14:36:42 +00:00
|
|
|
if(required)
|
|
|
|
{
|
|
|
|
// Tell the module that is about to be read that it should report
|
|
|
|
// a fatal error if the package is not found.
|
|
|
|
std::string req = this->Name;
|
|
|
|
req += "_FIND_REQUIRED";
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->AddDefinition(req.c_str(), "1");
|
2004-04-19 14:36:42 +00:00
|
|
|
}
|
|
|
|
|
2004-02-28 23:59:19 +00:00
|
|
|
// Load the module we found.
|
|
|
|
found = true;
|
|
|
|
return this->ReadListFile(mfile.c_str());
|
2003-01-21 22:15:22 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmFindPackageCommand::FindConfig()
|
|
|
|
{
|
|
|
|
std::string help = "The directory containing ";
|
|
|
|
help += this->Config;
|
|
|
|
help += ".";
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// Construct the list of relative paths to each prefix to be
|
|
|
|
// searched.
|
|
|
|
std::string rel = "/lib/";
|
|
|
|
rel += cmSystemTools::LowerCase(this->Name);
|
|
|
|
this->Relatives.push_back(rel);
|
|
|
|
rel = "/lib/";
|
|
|
|
rel += this->Name;
|
|
|
|
this->Relatives.push_back(rel);
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// It is likely that CMake will have recently built the project.
|
|
|
|
for(int i=1; i <= 10; ++i)
|
|
|
|
{
|
|
|
|
cmOStringStream r;
|
2006-05-10 19:46:45 +00:00
|
|
|
r << "[HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\"
|
|
|
|
"Settings\\StartPath;WhereBuild" << i << "]";
|
2003-01-21 22:15:22 +00:00
|
|
|
std::string entry = r.str();
|
|
|
|
cmSystemTools::ExpandRegistryValues(entry);
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(entry);
|
|
|
|
if(cmSystemTools::FileIsDirectory(entry.c_str()))
|
|
|
|
{
|
|
|
|
this->Builds.push_back(entry);
|
|
|
|
}
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// The project may be installed. Use the system search path to
|
|
|
|
// construct a list of possible install prefixes.
|
|
|
|
std::vector<std::string> systemPath;
|
|
|
|
cmSystemTools::GetPath(systemPath);
|
|
|
|
for(std::vector<std::string>::iterator i = systemPath.begin();
|
|
|
|
i != systemPath.end(); ++i)
|
|
|
|
{
|
|
|
|
*i += "/..";
|
|
|
|
if(cmSystemTools::FileIsDirectory(i->c_str()))
|
2004-04-26 14:49:34 +00:00
|
|
|
{
|
2003-01-21 22:15:22 +00:00
|
|
|
this->Prefixes.push_back(cmSystemTools::CollapseFullPath(i->c_str()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if !defined(WIN32) || defined(__CYGWIN__)
|
|
|
|
this->Prefixes.push_back("/usr/local");
|
|
|
|
this->Prefixes.push_back("/usr");
|
|
|
|
#endif
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// Look for the project's configuration file.
|
|
|
|
std::string init = this->SearchForConfig();
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// Store the entry in the cache so it can be set by the user.
|
2006-03-15 16:02:08 +00:00
|
|
|
this->Makefile->AddCacheDefinition(this->Variable.c_str(),
|
2003-01-21 22:15:22 +00:00
|
|
|
init.c_str(),
|
|
|
|
help.c_str(),
|
|
|
|
cmCacheManager::PATH);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
std::string cmFindPackageCommand::SearchForConfig() const
|
|
|
|
{
|
2004-04-26 15:00:41 +00:00
|
|
|
// Check the environment variable.
|
|
|
|
std::string env;
|
|
|
|
if(cmSystemTools::GetEnv(this->Variable.c_str(), env) && env.length() > 0)
|
|
|
|
{
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(env);
|
|
|
|
std::string f = env;
|
|
|
|
f += "/";
|
|
|
|
f += this->Config;
|
|
|
|
if(cmSystemTools::FileExists(f.c_str()))
|
|
|
|
{
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// Search the build directories.
|
|
|
|
for(std::vector<cmStdString>::const_iterator b = this->Builds.begin();
|
|
|
|
b != this->Builds.end(); ++b)
|
|
|
|
{
|
|
|
|
std::string f = *b;
|
|
|
|
f += "/";
|
|
|
|
f += this->Config;
|
|
|
|
if(cmSystemTools::FileExists(f.c_str()))
|
|
|
|
{
|
|
|
|
return *b;
|
|
|
|
}
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-21 22:15:22 +00:00
|
|
|
// Search paths relative to each installation prefix.
|
|
|
|
for(std::vector<cmStdString>::const_iterator p = this->Prefixes.begin();
|
|
|
|
p != this->Prefixes.end(); ++p)
|
|
|
|
{
|
|
|
|
std::string prefix = *p;
|
|
|
|
for(std::vector<cmStdString>::const_iterator r = this->Relatives.begin();
|
|
|
|
r != this->Relatives.end(); ++r)
|
|
|
|
{
|
|
|
|
std::string dir = prefix;
|
|
|
|
dir += *r;
|
|
|
|
std::string f = dir;
|
|
|
|
f += "/";
|
|
|
|
f += this->Config;
|
|
|
|
if(cmSystemTools::FileExists(f.c_str()))
|
|
|
|
{
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-04-26 14:49:34 +00:00
|
|
|
|
2003-01-31 18:50:42 +00:00
|
|
|
return this->Variable + "-NOTFOUND";
|
2003-01-21 22:15:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmFindPackageCommand::ReadListFile(const char* f)
|
|
|
|
{
|
2006-03-15 16:02:08 +00:00
|
|
|
if(this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),f))
|
2003-01-21 22:15:22 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
std::string e = "Error reading CMake code from \"";
|
|
|
|
e += f;
|
|
|
|
e += "\".";
|
|
|
|
this->SetError(e.c_str());
|
|
|
|
return false;
|
|
|
|
}
|