BUG: Fix link flags on cygwin shared libraries. This requires that the shared library prefix be supported in the link library regex.

This commit is contained in:
Brad King 2006-10-05 15:08:20 -04:00
parent 7e92f0b4e4
commit 7ad07e0811
6 changed files with 12 additions and 9 deletions

View File

@ -1712,8 +1712,10 @@ void cmLocalGenerator
orderLibs.SetLinkTypeInformation(cmOrderLinkDirectories::LinkShared, orderLibs.SetLinkTypeInformation(cmOrderLinkDirectories::LinkShared,
static_link_type_flag, static_link_type_flag,
shared_link_type_flag); shared_link_type_flag);
orderLibs.SetLinkPrefix( orderLibs.AddLinkPrefix(
this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_PREFIX")); this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_PREFIX"));
orderLibs.AddLinkPrefix(
this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_PREFIX"));
orderLibs.AddLinkExtension( orderLibs.AddLinkExtension(
this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"), this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"),
cmOrderLinkDirectories::LinkStatic); cmOrderLinkDirectories::LinkStatic);

View File

@ -189,9 +189,10 @@ void cmOrderLinkDirectories::CreateRegularExpressions()
// be the library name. Match index 3 will be the library // be the library name. Match index 3 will be the library
// extension. // extension.
reg = "^("; reg = "^(";
if(!this->LinkPrefix.empty()) for(std::set<cmStdString>::iterator p = this->LinkPrefixes.begin();
p != this->LinkPrefixes.end(); ++p)
{ {
reg += this->LinkPrefix; reg += *p;
reg += "|"; reg += "|";
} }
reg += ")"; reg += ")";

View File

@ -83,11 +83,11 @@ public:
} }
} }
// should be set from CMAKE_STATIC_LIBRARY_PREFIX // should be set from CMAKE_STATIC_LIBRARY_PREFIX
void SetLinkPrefix(const char* s) void AddLinkPrefix(const char* s)
{ {
if(s) if(s)
{ {
this->LinkPrefix = s; this->LinkPrefixes.insert(s);
} }
} }
// Return any warnings if the exist // Return any warnings if the exist
@ -164,7 +164,7 @@ private:
std::vector<cmStdString> SharedLinkExtensions; std::vector<cmStdString> SharedLinkExtensions;
std::vector<cmStdString> LinkExtensions; std::vector<cmStdString> LinkExtensions;
// the names of link prefixes // the names of link prefixes
cmStdString LinkPrefix; std::set<cmStdString> LinkPrefixes;
// 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> ImpossibleDirectories; std::set<cmStdString> ImpossibleDirectories;
// Name of target // Name of target

View File

@ -108,7 +108,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.AddLinkPrefix("lib");
cmTargetManifest manifest; cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories, orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, ""); manifest, "");

View File

@ -108,7 +108,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.AddLinkPrefix("lib");
cmTargetManifest manifest; cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories, orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, ""); manifest, "");

View File

@ -108,7 +108,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.AddLinkPrefix("lib");
cmTargetManifest manifest; cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories, orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, ""); manifest, "");