diff options
author | Brad King <brad.king@kitware.com> | 2009-07-28 12:08:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-07-28 12:08:00 (GMT) |
commit | 855d07f80eb8c83100fcb8878623fcb917acab33 (patch) | |
tree | 72841a3915df4ef5e8d3c282208edc84afb43eba /Source/cmComputeLinkInformation.cxx | |
parent | 06a1e35d8ad34352878db12113680d4c5f2ea45f (diff) | |
download | CMake-855d07f80eb8c83100fcb8878623fcb917acab33.zip CMake-855d07f80eb8c83100fcb8878623fcb917acab33.tar.gz CMake-855d07f80eb8c83100fcb8878623fcb917acab33.tar.bz2 |
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".
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c47f931..4958fee 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -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. |