ENH: Added support for linking to MS .lib libraries in MinGW.

This commit is contained in:
Brad King 2006-03-22 11:10:58 -05:00
parent 3806c1050d
commit 0376fe4b9b
2 changed files with 15 additions and 1 deletions

View File

@ -17,10 +17,11 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
SET(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib
IF(MINGW)
SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
ENDIF(MINGW)
SET(CMAKE_C_CREATE_SHARED_MODULE

View File

@ -1318,8 +1318,21 @@ cmLocalGenerator::ComputeLinkInformation(cmTarget& target,
this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"));
orderLibs.AddLinkExtension(
this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"));
orderLibs.AddLinkExtension(
this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"));
orderLibs.AddLinkExtension(
this->Makefile->GetDefinition("CMAKE_LINK_LIBRARY_SUFFIX"));
if(const char* linkSuffixes =
this->Makefile->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS"))
{
std::vector<std::string> linkSuffixVec;
cmSystemTools::ExpandListArgument(linkSuffixes, linkSuffixVec);
for(std::vector<std::string>::iterator i = linkSuffixVec.begin();
i != linkSuffixVec.end(); ++i)
{
orderLibs.AddLinkExtension(i->c_str());
}
}
orderLibs.SetLinkInformation(target.GetName(),
linkLibraries,
linkDirectories);