ENH: fix bug 2087 lib prefix stripped off on windows

This commit is contained in:
Bill Hoffman 2005-08-10 12:55:41 -04:00
parent b058a5e1aa
commit e59e9d0e59
7 changed files with 35 additions and 7 deletions

View File

@ -1352,6 +1352,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
{ {
orderLibs.AddLinkExtension(ext.c_str()); orderLibs.AddLinkExtension(ext.c_str());
} }
ext =
m_CurrentMakefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
if(ext.size())
{
orderLibs.SetLinkPrefix(ext.c_str());
}
ext = ext =
m_CurrentMakefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"); m_CurrentMakefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX");
if(ext.size()) if(ext.size())

View File

@ -1285,6 +1285,12 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
{ {
orderLibs.AddLinkExtension(ext.c_str()); orderLibs.AddLinkExtension(ext.c_str());
} }
ext =
m_Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX");
if(ext.size())
{
orderLibs.SetLinkPrefix(ext.c_str());
}
ext = ext =
m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"); m_Makefile->GetSafeDefinition("CMAKE_SHARED_LIBRARY_SUFFIX");
if(ext.size()) if(ext.size())

View File

@ -115,17 +115,23 @@ void cmOrderLinkDirectories::CreateRegularExpressions()
} }
first = false; first = false;
libext += "\\"; libext += "\\";
#ifndef _WIN32 #if defined(_WIN32) && !defined(__CYGWIN__)
libext += *i;
#else
libext += this->NoCaseExpression(i->c_str()); libext += this->NoCaseExpression(i->c_str());
#else
libext += *i;
#endif #endif
} }
libext += ").*"; libext += ").*";
cmStdString reg("(.*)"); cmStdString reg("(.*)");
reg += libext; reg += libext;
m_RemoveLibraryExtension.compile(reg.c_str()); m_RemoveLibraryExtension.compile(reg.c_str());
reg = "^lib([^/]*)"; reg = "";
if(m_LinkPrefix.size())
{
reg = "^";
reg += m_LinkPrefix;
}
reg += "([^/]*)";
reg += libext; reg += libext;
m_ExtractBaseLibraryName.compile(reg.c_str()); m_ExtractBaseLibraryName.compile(reg.c_str());
reg = "([^/]*)"; reg = "([^/]*)";

View File

@ -64,9 +64,14 @@ public:
// CMAKE_SHARED_LIBRARY_SUFFIX // CMAKE_SHARED_LIBRARY_SUFFIX
// CMAKE_LINK_LIBRARY_SUFFIX // CMAKE_LINK_LIBRARY_SUFFIX
void AddLinkExtension(const char* e) void AddLinkExtension(const char* e)
{ {
m_LinkExtensions.push_back(e); m_LinkExtensions.push_back(e);
} }
// should be set from CMAKE_STATIC_LIBRARY_PREFIX
void SetLinkPrefix(const char* s)
{
m_LinkPrefix = s;
}
// Return any warnings if the exist // Return any warnings if the exist
std::string GetWarnings(); std::string GetWarnings();
// return a list of all full path libraries // return a list of all full path libraries
@ -120,6 +125,8 @@ private:
std::set<cmStdString> m_LinkPathSet; std::set<cmStdString> m_LinkPathSet;
// the names of link extensions // the names of link extensions
std::vector<cmStdString> m_LinkExtensions; std::vector<cmStdString> m_LinkExtensions;
// the names of link prefixes
cmStdString m_LinkPrefix;
// set of directories that can not be put in the correct order // set of directories that can not be put in the correct order
std::set<cmStdString> m_ImposibleDirectories; std::set<cmStdString> m_ImposibleDirectories;
// library regular expressions // library regular expressions

View File

@ -56,6 +56,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn(); orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so"); orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a"); orderLibs.AddLinkExtension(".a");
orderLibs.SetLinkPrefix("lib");
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A"); orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder(); bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems); orderLibs.GetLinkerInformation(sortedpaths, linkItems);

View File

@ -56,6 +56,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn(); orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so"); orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a"); orderLibs.AddLinkExtension(".a");
orderLibs.SetLinkPrefix("lib");
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A"); orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder(); bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems); orderLibs.GetLinkerInformation(sortedpaths, linkItems);

View File

@ -56,6 +56,7 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.DebugOn(); orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so"); orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a"); orderLibs.AddLinkExtension(".a");
orderLibs.SetLinkPrefix("lib");
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A"); orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder(); bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems); orderLibs.GetLinkerInformation(sortedpaths, linkItems);