summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-03 13:56:44 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-03 13:56:44 (GMT)
commit3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d (patch)
treed27ff59dbffe4dd8b672b9439266b2360b44e298 /Source/cmComputeLinkInformation.cxx
parentd444fea16339e3d39bc38244d2f0ee36b31b6be1 (diff)
parentdc1d025197d48829f2c0389824c8273b9e257413 (diff)
downloadCMake-3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d.zip
CMake-3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d.tar.gz
CMake-3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d.tar.bz2
Merge topic 'rpath-on-mac'
dc1d025 OS X: Add test for rpaths on Mac. 8576b3f OS X: Add support for @rpath in export files. 00d71bd Xcode: Add rpath support in Xcode generator. 94e7fef OS X: Add RPATH support for Mac.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx60
1 files changed, 53 insertions, 7 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 0158508..02495c4 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1730,6 +1730,17 @@ void
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
cmTarget* target)
{
+ // Ignore targets on Apple where install_name is not @rpath.
+ // The dependenty library can be found with other means such as
+ // @loader_path or full paths.
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ {
+ if(!target->HasMacOSXRpath(this->Config))
+ {
+ return;
+ }
+ }
+
// Libraries with unknown type must be handled using just the file
// on disk.
if(target->GetType() == cmTarget::UNKNOWN_LIBRARY)
@@ -1762,25 +1773,60 @@ void
cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
{
// Get the name of the library from the file name.
+ bool is_shared_library = false;
std::string file = cmSystemTools::GetFilenameName(fullPath);
- if(!this->ExtractSharedLibraryName.find(file.c_str()))
+
+ if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ {
+ // Check that @rpath is part of the install name.
+ // If it isn't, return.
+ std::string soname;
+ if(!cmSystemTools::GuessLibraryInstallName(fullPath, soname))
+ {
+ return;
+ }
+
+ if(soname.find("@rpath") == std::string::npos)
+ {
+ return;
+ }
+ }
+
+ is_shared_library = this->ExtractSharedLibraryName.find(file.c_str());
+
+ if(!is_shared_library)
{
// On some platforms (AIX) a shared library may look static.
if(this->ArchivesMayBeShared)
{
- if(!this->ExtractStaticLibraryName.find(file.c_str()))
+ if(this->ExtractStaticLibraryName.find(file.c_str()))
{
- // This is not the name of a shared library or archive.
- return;
+ // This is the name of a shared library or archive.
+ is_shared_library = true;
}
}
- else
+ }
+
+ // It could be an Apple framework
+ if(!is_shared_library)
+ {
+ if(fullPath.find(".framework") != std::string::npos)
{
- // This is not the name of a shared library.
- return;
+ cmsys::RegularExpression splitFramework;
+ splitFramework.compile("^(.*)/(.*).framework/.*/(.*)$");
+ if(splitFramework.find(fullPath) &&
+ (splitFramework.match(2) == splitFramework.match(3)))
+ {
+ is_shared_library = true;
+ }
}
}
+ if(!is_shared_library)
+ {
+ return;
+ }
+
// Include this library in the runtime path ordering.
this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath);
if(this->LinkWithRuntimePath)