ENH: removed unused methods after find changes

This commit is contained in:
Bill Hoffman 2006-03-02 15:03:36 -05:00
parent 2000940136
commit 0db4cb0d96
2 changed files with 0 additions and 242 deletions

View File

@ -2194,234 +2194,6 @@ void cmMakefile::DisplayStatus(const char* message, float s)
->GetCMakeInstance()->UpdateProgress(message, s);
}
/**
* Find the library with the given name. Searches the given path and then
* the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned.
*/
std::string cmMakefile::FindLibrary(const char* name,
const std::vector<std::string>& userPaths)
{
// See if the executable exists as written.
if(cmSystemTools::FileExists(name))
{
return cmSystemTools::CollapseFullPath(name);
}
// Construct a search path.
std::vector<std::string> path;
this->GetLibrarySearchPath(userPaths, path);
bool supportFrameworks = false;
if(this->GetDefinition("APPLE"))
{
supportFrameworks = true;
}
// Add some lib directories specific to compilers, depending on the
// current generator, so that library that might have been stored here
// can be found too.
// i.e. Microsoft Visual Studio or .Net: path to compiler/../Lib
// Borland: path to compiler/../Lib
const char* genName = this->GetDefinition("CMAKE_GENERATOR");
if (genName)
{
if (!strcmp(genName, "NMake Makefiles") ||
!strcmp(genName, "Visual Studio 6"))
{
const char* compiler = this->GetDefinition("CMAKE_CXX_COMPILER");
if (compiler)
{
std::string compiler_path = cmSystemTools::FindProgram(compiler);
if (compiler_path.size())
{
std::string lib_path =
cmSystemTools::GetFilenamePath(
cmSystemTools::GetFilenamePath(compiler_path)) + "/Lib";
path.push_back(lib_path);
}
}
}
else if (!strcmp(genName, "Visual Studio 7"))
{
// It is likely that the compiler won't be in the path for .Net, but
// we know where devenv is.
const char* devenv = this->GetDefinition("MICROSOFT_DEVENV");
if (devenv)
{
std::string devenv_path = cmSystemTools::FindProgram(devenv);
if (devenv_path.size())
{
std::string vc7_path =
cmSystemTools::GetFilenamePath(
cmSystemTools::GetFilenamePath(
cmSystemTools::GetFilenamePath(devenv_path))) + "/Vc7";
path.push_back(vc7_path + "/lib");
path.push_back(vc7_path + "/PlatformSDK/lib");
}
}
}
else if (!strcmp(genName, "Borland Makefiles"))
{
const char* bcb_bin_path = this->GetDefinition("BCB_BIN_PATH");
if (bcb_bin_path)
{
std::string lib_path =
cmSystemTools::GetFilenamePath(bcb_bin_path) + "/Lib";
path.push_back(lib_path);
}
}
else if(supportFrameworks)
{
path.push_back("~/Library/Frameworks");
path.push_back("/Library/Frameworks");
path.push_back("/Network/Library/Frameworks");
path.push_back("/System/Library/Frameworks");
}
}
if(m_LocalGenerator->GetGlobalGenerator()->GetLanguageEnabled("C"))
{
std::string voidsize = this->GetRequiredDefinition("CMAKE_SIZEOF_VOID_P");
int size = atoi(voidsize.c_str());
std::vector<std::string> path64;
if(size == 8)
{
// Convert each search path to possible 32- and 64-bit versions
// of the names. Check for the existence of each one here to
// avoid repeating the check for every file search.
for(std::vector<std::string>::iterator i = path.begin();
i != path.end(); ++i)
{
std::string s = *i;
std::string s2 = *i;
cmSystemTools::ReplaceString(s, "lib/", "lib64/");
if((s != *i) && cmSystemTools::FileIsDirectory(s.c_str()))
{
path64.push_back(s);
}
s2 += "64";
if(cmSystemTools::FileIsDirectory(s2.c_str()))
{
path64.push_back(s2);
}
if(cmSystemTools::FileIsDirectory(i->c_str()))
{
path64.push_back(*i);
}
}
// now look for the library in the 64 bit path
path = path64;
}
}
// See if the library exists as written.
if(cmSystemTools::FileExists(name) &&
!cmSystemTools::FileIsDirectory(name))
{
return cmSystemTools::CollapseFullPath(name);
}
// Get the list of possible prefixes and suffixes for libraries on
// this platform.
const char* prefixes_list =
this->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES");
const char* suffixes_list =
this->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES");
std::vector<std::string> prefixes;
std::vector<std::string> suffixes;
cmSystemTools::ExpandListArgument(prefixes_list, prefixes, true);
cmSystemTools::ExpandListArgument(suffixes_list, suffixes, true);
std::string tryPath;
for(std::vector<std::string>::const_iterator p = path.begin();
p != path.end(); ++p)
{
// Look for a framework.
if(supportFrameworks)
{
tryPath = *p;
tryPath += "/";
tryPath += name;
tryPath += ".framework";
if(cmSystemTools::FileExists(tryPath.c_str())
&& cmSystemTools::FileIsDirectory(tryPath.c_str()))
{
tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
cmSystemTools::ConvertToUnixSlashes(tryPath);
return tryPath;
}
}
// Try various library naming conventions.
for(std::vector<std::string>::iterator prefix = prefixes.begin();
prefix != prefixes.end(); ++prefix)
{
for(std::vector<std::string>::iterator suffix = suffixes.begin();
suffix != suffixes.end(); ++suffix)
{
tryPath = *p;
tryPath += "/";
tryPath += *prefix;
tryPath += name;
tryPath += *suffix;
if(cmSystemTools::FileExists(tryPath.c_str())
&& !cmSystemTools::FileIsDirectory(tryPath.c_str()))
{
tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
cmSystemTools::ConvertToUnixSlashes(tryPath);
return tryPath;
}
}
}
}
// Couldn't find the library.
return "";
}
//----------------------------------------------------------------------------
void
cmMakefile::GetIncludeSearchPath(const std::vector<std::string>& callerPaths,
std::vector<std::string>& path)
{
// Add paths configured into the cache for this project.
if(const char* cmakeIncludePath = this->GetDefinition("CMAKE_INCLUDE_PATH"))
{
cmSystemTools::ExpandListArgument(cmakeIncludePath, path);
}
// Add paths in the user's environment.
cmSystemTools::GetPath(path, "CMAKE_INCLUDE_PATH");
cmSystemTools::GetPath(path, "INCLUDE");
// Add standard system paths.
cmSystemTools::GetPath(path);
// Add paths given by the caller.
path.insert(path.end(), callerPaths.begin(), callerPaths.end());
}
//----------------------------------------------------------------------------
void
cmMakefile::GetLibrarySearchPath(const std::vector<std::string>& callerPaths,
std::vector<std::string>& path)
{
// Add paths configured into the cache for this project.
if(const char* cmakeLibPath = this->GetDefinition("CMAKE_LIBRARY_PATH"))
{
cmSystemTools::ExpandListArgument(cmakeLibPath, path);
}
// Add paths in the user's environment.
cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH");
cmSystemTools::GetPath(path, "LIB");
// Add standard system paths.
cmSystemTools::GetPath(path);
// Add paths given by the caller.
path.insert(path.end(), callerPaths.begin(), callerPaths.end());
}
std::string cmMakefile::GetModulesFile(const char* filename)
{
std::vector<std::string> modulePath;

View File

@ -232,20 +232,6 @@ public:
*/
void AddIncludeDirectory(const char*, bool before = false);
/**
* Find a library (as in cmSystemTools) but add in compiler specific paths
*/
std::string FindLibrary(const char* name,
const std::vector<std::string>& path);
/**
* Get the include file or library search path.
*/
void GetIncludeSearchPath(const std::vector<std::string>& callerPaths,
std::vector<std::string>& path);
void GetLibrarySearchPath(const std::vector<std::string>& callerPaths,
std::vector<std::string>& path);
/**
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.