diff options
author | Brad King <brad.king@kitware.com> | 2008-02-21 18:58:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-02-21 18:58:41 (GMT) |
commit | 782e9f7ffe722fc7dac1353cd95a31e7140e5c6f (patch) | |
tree | b4acc56525e8c006fd2da48e28d5f28c41a8e3e0 /Source/cmComputeLinkInformation.cxx | |
parent | fd37a6ec3d31e65eed2dfa88246e86b8d0ab66ab (diff) | |
download | CMake-782e9f7ffe722fc7dac1353cd95a31e7140e5c6f.zip CMake-782e9f7ffe722fc7dac1353cd95a31e7140e5c6f.tar.gz CMake-782e9f7ffe722fc7dac1353cd95a31e7140e5c6f.tar.bz2 |
ENH: Improve linking to third-party shared libraries on soname platforms
- Reduce false positives in cases of unknown soname
- Make library extension regular expressions match only at end of string
- When linking to libraries in implicit dirs convert to the -l option
only if the file name is one that can be found by the linker
(ex. /usr/lib/libfoo.so.1 should be linked by full path)
- Add cmSystemTools::GuessLibrarySOName to guess the soname of a
library based on presence of a symlink
- In cmComputeLinkInformation try to guess an soname before assuming
that a third-party library is built without an soname
- In cmOrderDirectories guess the soname of shared libraries in cases
it is otherwise unknown
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 1da512c..1899bd2 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -27,6 +27,8 @@ #include <ctype.h> +//#define CM_COMPUTE_LINK_INFO_DEBUG + /* Notes about linking on various platforms: @@ -905,7 +907,7 @@ cmComputeLinkInformation } // Finish the list. - libext += ").*"; + libext += ")$"; return libext; } @@ -1070,6 +1072,13 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item) return false; } + // Only apply the policy below if the library file is one that can + // be found by the linker. + if(!this->ExtractAnyLibraryName.find(item)) + { + return false; + } + // Many system linkers support multiple architectures by // automatically selecting the implicit linker search path for the // current architecture. If the library appears in an implicit link @@ -1262,13 +1271,19 @@ bool cmComputeLinkInformation::CheckSharedLibNoSOName(std::string const& item) { // This platform will use the path to a library as its soname if the // library is given via path and was not built with an soname. If - // this is a shared library that might be the case. TODO: Check if - // the lib is a symlink to detect that it actually has an soname. + // this is a shared library that might be the case. std::string file = cmSystemTools::GetFilenameName(item); if(this->ExtractSharedLibraryName.find(file)) { - this->AddSharedLibNoSOName(item); - return true; + // If we can guess the soname fairly reliably then assume the + // library has one. Otherwise assume the library has no builtin + // soname. + std::string soname; + if(!cmSystemTools::GuessLibrarySOName(item, soname)) + { + this->AddSharedLibNoSOName(item); + return true; + } } return false; } |