BUG: Always pass linker flags untouched
In cmComputeLinkInformation we recognize link options that look like library file names, but pass flags starting in '-' through untouched. This fixes the ordering of the check to recognize '-' flags first in case the rest of the option looks like a library file name, as in the case of "-l:libfoo.a".
This commit is contained in:
parent
06a1e35d8a
commit
855d07f80e
|
@ -1184,7 +1184,28 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
|
|||
//
|
||||
// foo ==> -lfoo
|
||||
// libfoo.a ==> -Wl,-Bstatic -lfoo
|
||||
std::string lib;
|
||||
|
||||
// Pass flags through untouched.
|
||||
if(item[0] == '-' || item[0] == '$' || item[0] == '`')
|
||||
{
|
||||
// if this is a -l option then we might need to warn about
|
||||
// CMP0003 so put it in OldUserFlagItems, if it is not a -l
|
||||
// or -Wl,-l (-framework -pthread), then allow it without a
|
||||
// CMP0003 as -L will not affect those other linker flags
|
||||
if(item.find("-l") == 0 || item.find("-Wl,-l") == 0)
|
||||
{
|
||||
// This is a linker option provided by the user.
|
||||
this->OldUserFlagItems.push_back(item);
|
||||
}
|
||||
|
||||
// Restore the target link type since this item does not specify
|
||||
// one.
|
||||
this->SetCurrentLinkType(this->StartLinkType);
|
||||
|
||||
// Use the item verbatim.
|
||||
this->Items.push_back(Item(item, false));
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse out the prefix, base, and suffix components of the
|
||||
// library name. If the name matches that of a shared or static
|
||||
|
@ -1196,6 +1217,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
|
|||
// libfoo.dll.a for import libraries and libfoo.a for static
|
||||
// libraries. On AIX a library with the name libfoo.a can be
|
||||
// shared!
|
||||
std::string lib;
|
||||
if(this->ExtractSharedLibraryName.find(item))
|
||||
{
|
||||
// This matches a shared library file name.
|
||||
|
@ -1242,26 +1264,6 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
|
|||
// Use just the library name so the linker will search.
|
||||
lib = this->ExtractAnyLibraryName.match(2);
|
||||
}
|
||||
else if(item[0] == '-' || item[0] == '$' || item[0] == '`')
|
||||
{
|
||||
// if this is a -l option then we might need to warn about
|
||||
// CMP0003 so put it in OldUserFlagItems, if it is not a -l
|
||||
// or -Wl,-l (-framework -pthread), then allow it without a
|
||||
// CMP0003 as -L will not affect those other linker flags
|
||||
if(item.find("-l") == 0 || item.find("-Wl,-l") == 0)
|
||||
{
|
||||
// This is a linker option provided by the user.
|
||||
this->OldUserFlagItems.push_back(item);
|
||||
}
|
||||
|
||||
// Restore the target link type since this item does not specify
|
||||
// one.
|
||||
this->SetCurrentLinkType(this->StartLinkType);
|
||||
|
||||
// Use the item verbatim.
|
||||
this->Items.push_back(Item(item, false));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a name specified by the user.
|
||||
|
|
Loading…
Reference in New Issue