summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-09 20:05:13 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-09 20:05:13 (GMT)
commit33587ce37676c906b7deed07764e2757c6f3997f (patch)
tree995db15982faea296f647f0788cdca9ae8c5e494 /Source/cmMakefile.cxx
parent0ddf06e952088c95147312c486da9835f84385b2 (diff)
downloadCMake-33587ce37676c906b7deed07764e2757c6f3997f.zip
CMake-33587ce37676c906b7deed07764e2757c6f3997f.tar.gz
CMake-33587ce37676c906b7deed07764e2757c6f3997f.tar.bz2
ENH: Added platform settings CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES to allow customized searching for libraries.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx50
1 files changed, 26 insertions, 24 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4eae622..d8ba05a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2310,17 +2310,16 @@ std::string cmMakefile::FindLibrary(const char* name,
return cmSystemTools::CollapseFullPath(name);
}
- // Construct a list of possible suffixes.
- const char* windows_suffixes[] = {".lib", 0};
- const char* unix_suffixes[] = {".so", ".sl", ".dylib", ".a",
- ".dll", ".dll.a", 0};
- bool windowsLibs = false;
- if(cmSystemTools::IsOn(this->GetDefinition("WIN32")) &&
- !cmSystemTools::IsOn(this->GetDefinition("CYGWIN")) &&
- !cmSystemTools::IsOn(this->GetDefinition("MINGW")))
- {
- windowsLibs = true;
- }
+ // 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);
+ cmSystemTools::ExpandListArgument(suffixes_list, suffixes);
std::string tryPath;
for(std::vector<std::string>::const_iterator p = path.begin();
@@ -2343,21 +2342,24 @@ std::string cmMakefile::FindLibrary(const char* name,
}
// Try various library naming conventions.
- const char* prefix = windowsLibs? "" : "lib";
- const char** suffixes = windowsLibs? windows_suffixes : unix_suffixes;
- for(const char** suffix = suffixes; *suffix; ++suffix)
+ for(std::vector<std::string>::iterator prefix = prefixes.begin();
+ prefix != prefixes.end(); ++prefix)
{
- tryPath = *p;
- tryPath += "/";
- tryPath += prefix;
- tryPath += name;
- tryPath += *suffix;
- if(cmSystemTools::FileExists(tryPath.c_str())
- && !cmSystemTools::FileIsDirectory(tryPath.c_str()))
+ for(std::vector<std::string>::iterator suffix = suffixes.begin();
+ suffix != suffixes.end(); ++suffix)
{
- tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
- cmSystemTools::ConvertToUnixSlashes(tryPath);
- return tryPath;
+ 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;
+ }
}
}
}