summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderDirectories.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2013-04-27 04:04:44 (GMT)
committerBrad King <brad.king@kitware.com>2013-06-03 13:42:05 (GMT)
commit94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18 (patch)
tree4676709c61c7f1d8352f5e9729bb875cb2816e34 /Source/cmOrderDirectories.cxx
parentcbe3f2072bdd181660bc4f9174a73febd3ed5230 (diff)
downloadCMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.zip
CMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.tar.gz
CMake-94e7fef2268ba9d31bd31834f05f6d0c2ffe5a18.tar.bz2
OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH property turned on. For install time, it is also useful to set INSTALL_RPATH to help find dependent libraries with an @rpath in their install name. Also adding detection of rpath conflicts when using frameworks.
Diffstat (limited to 'Source/cmOrderDirectories.cxx')
-rw-r--r--Source/cmOrderDirectories.cxx45
1 files changed, 41 insertions, 4 deletions
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 6e41768..93885b2 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -36,8 +36,25 @@ public:
OD(od), GlobalGenerator(od->GlobalGenerator)
{
this->FullPath = file;
- this->Directory = cmSystemTools::GetFilenamePath(file);
- this->FileName = cmSystemTools::GetFilenameName(file);
+
+ if(file.rfind(".framework") != std::string::npos)
+ {
+ cmsys::RegularExpression splitFramework;
+ splitFramework.compile("^(.*)/(.*).framework/.*/(.*)$");
+ if(splitFramework.find(file) &&
+ (splitFramework.match(2) == splitFramework.match(3)))
+ {
+ this->Directory = splitFramework.match(1);
+ this->FileName =
+ std::string(file.begin() + this->Directory.size() + 1, file.end());
+ }
+ }
+
+ if(this->FileName.empty())
+ {
+ this->Directory = cmSystemTools::GetFilenamePath(file);
+ this->FileName = cmSystemTools::GetFilenameName(file);
+ }
}
virtual ~cmOrderDirectoriesConstraint() {}
@@ -301,22 +318,42 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
// Add the runtime library at most once.
if(this->EmmittedConstraintSOName.insert(fullPath).second)
{
+ std::string soname2 = soname ? soname : "";
// Implicit link directories need special handling.
if(!this->ImplicitDirectories.empty())
{
std::string dir = cmSystemTools::GetFilenamePath(fullPath);
+
+ if(fullPath.rfind(".framework") != std::string::npos)
+ {
+ cmsys::RegularExpression splitFramework;
+ splitFramework.compile("^(.*)/(.*).framework/(.*)/(.*)$");
+ if(splitFramework.find(fullPath) &&
+ (splitFramework.match(2) == splitFramework.match(4)))
+ {
+ dir = splitFramework.match(1);
+ soname2 = splitFramework.match(2);
+ soname2 += ".framework/";
+ soname2 += splitFramework.match(3);
+ soname2 += "/";
+ soname2 += splitFramework.match(4);
+ }
+ }
+
if(this->ImplicitDirectories.find(dir) !=
this->ImplicitDirectories.end())
{
this->ImplicitDirEntries.push_back(
- new cmOrderDirectoriesConstraintSOName(this, fullPath, soname));
+ new cmOrderDirectoriesConstraintSOName(this, fullPath,
+ soname2.c_str()));
return;
}
}
// Construct the runtime information entry for this library.
this->ConstraintEntries.push_back(
- new cmOrderDirectoriesConstraintSOName(this, fullPath, soname));
+ new cmOrderDirectoriesConstraintSOName(this, fullPath,
+ soname2.c_str()));
}
else
{