diff options
author | Brad King <brad.king@kitware.com> | 2008-01-31 12:50:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-31 12:50:40 (GMT) |
commit | 3a05425309dd19f4c91febdf96b4ac3fc1d17ce5 (patch) | |
tree | 4f14c27a2a15110486bb93ade1c50b17154ee977 /Source/cmFindLibraryCommand.cxx | |
parent | 73a5f0846f4946d74bbe7822fdf5458481e03362 (diff) | |
download | CMake-3a05425309dd19f4c91febdf96b4ac3fc1d17ce5.zip CMake-3a05425309dd19f4c91febdf96b4ac3fc1d17ce5.tar.gz CMake-3a05425309dd19f4c91febdf96b4ac3fc1d17ce5.tar.bz2 |
BUG: Move decision to switch library paths found in implicit link directories to use -l options from cmFindLibraryCommand to cmComputeLinkInformation. Existing projects may depend on find_library returning a full path. This slightly weakens cmComputeLinkInformation but is necessary for compatibility.
Diffstat (limited to 'Source/cmFindLibraryCommand.cxx')
-rw-r--r-- | Source/cmFindLibraryCommand.cxx | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 34f476e..6b8b105 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -52,17 +52,6 @@ cmFindLibraryCommand::cmFindLibraryCommand() "When a full path to a framework is used as a library, " "CMake will use a -framework A, and a -F<fullPath> to " "link the framework to the target. "; - this->GenericDocumentation += - "\n" - "Some platforms define implicit library directories such as " - "/lib and /usr/lib that are automatically searched by the linker. " - "If this command finds a library in one of these directories " - "it will report only the name of the library file and not the path. " - "When the name is used to link the library CMake will generate a " - "link line that asks the linker to search for it. This allows " - "the system linker to automatically adjust the implicit directory " - "set based on the current architecture." - ; } // cmFindLibraryCommand @@ -86,26 +75,6 @@ bool cmFindLibraryCommand this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } - - // If the existing value was loaded from a cache written by CMake - // 2.4 or below then force the implicit link directory fix on the - // value. - if(this->Makefile->NeedCacheCompatibility(2, 4)) - { - if(const char* v = - this->Makefile->GetDefinition(this->VariableName.c_str())) - { - std::string nv = this->FixForImplicitLocations(v); - if(nv != v) - { - this->Makefile - ->AddCacheDefinition(this->VariableName.c_str(), - nv.c_str(), - this->VariableDocumentation.c_str(), - cmCacheManager::FILEPATH); - } - } - } return true; } @@ -134,7 +103,6 @@ bool cmFindLibraryCommand library = this->FindLibrary(i->c_str()); if(library != "") { - library = this->FixForImplicitLocations(library); this->Makefile->AddCacheDefinition(this->VariableName.c_str(), library.c_str(), this->VariableDocumentation.c_str(), @@ -320,43 +288,3 @@ std::string cmFindLibraryCommand::FindLibrary(const char* name) // Couldn't find the library. return ""; } - -//---------------------------------------------------------------------------- -std::string -cmFindLibraryCommand::FixForImplicitLocations(std::string const& lib) -{ - // Get implicit link directories for the platform. - const char* implicitLinks = - (this->Makefile->GetDefinition - ("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES")); - if(!implicitLinks) - { - // There are no implicit link directories. No fix is needed. - return lib; - } - std::vector<std::string> implicitLinkVec; - cmSystemTools::ExpandListArgument(implicitLinks, implicitLinkVec); - - // Get the path containing the library. - std::string libDir = cmSystemTools::GetFilenamePath(lib); - - // 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 - // directory then just report the file name without the directory - // portion. This will allow the system linker to locate the proper - // library for the architecture at link time. - for(std::vector<std::string>::const_iterator i = implicitLinkVec.begin(); - i != implicitLinkVec.end(); ++i) - { - if(*i == libDir) - { - // The library appears in an implicit link directory. Report - // only the file name. - return cmSystemTools::GetFilenameName(lib); - } - } - - // No implicit link directory matched. No fix is needed. - return lib; -} |