summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-02-02 04:18:04 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2014-02-03 14:04:54 (GMT)
commit028a5285d8ff5053fc96ea9840cb341bdf636e24 (patch)
treebdf44e70945eb207b0f61f38ace628029fed8f5b /Source/cmInstallTargetGenerator.cxx
parent6385c7151631a4ac72490540fe75cb0b9ebbedf5 (diff)
downloadCMake-028a5285d8ff5053fc96ea9840cb341bdf636e24.zip
CMake-028a5285d8ff5053fc96ea9840cb341bdf636e24.tar.gz
CMake-028a5285d8ff5053fc96ea9840cb341bdf636e24.tar.bz2
OS X: Make sure RPATHs are unique to avoid possible corruption.
When using link_directories() and including CMAKE_CFG_INTDIR, one can end up with duplicate RPATHs in the binary which install_name_tool cannot fix without corrupting the binary. Also, the cmake_install.cmake file has been fixed to correctly handle these generator specific variables.
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx30
1 files changed, 22 insertions, 8 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 68f45a6..7a39f45 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -669,22 +669,36 @@ cmInstallTargetGenerator
cli->GetRPath(oldRuntimeDirs, false);
cli->GetRPath(newRuntimeDirs, true);
- // Note: These are separate commands to avoid install_name_tool
- // corruption on 10.6.
+ // Note: These paths are kept unique to avoid install_name_tool corruption.
+ std::set<std::string> runpaths;
for(std::vector<std::string>::const_iterator i = oldRuntimeDirs.begin();
i != oldRuntimeDirs.end(); ++i)
{
- os << indent << "execute_process(COMMAND " << installNameTool << "\n";
- os << indent << " -delete_rpath \"" << *i << "\"\n";
- os << indent << " \"" << toDestDirPath << "\")\n";
+ std::string runpath = this->Target->GetMakefile()->GetLocalGenerator()->
+ GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
+
+ if(runpaths.find(runpath) == runpaths.end())
+ {
+ runpaths.insert(runpath);
+ os << indent << "execute_process(COMMAND " << installNameTool << "\n";
+ os << indent << " -delete_rpath \"" << runpath << "\"\n";
+ os << indent << " \"" << toDestDirPath << "\")\n";
+ }
}
+ runpaths.clear();
for(std::vector<std::string>::const_iterator i = newRuntimeDirs.begin();
i != newRuntimeDirs.end(); ++i)
{
- os << indent << "execute_process(COMMAND " << installNameTool << "\n";
- os << indent << " -add_rpath \"" << *i << "\"\n";
- os << indent << " \"" << toDestDirPath << "\")\n";
+ std::string runpath = this->Target->GetMakefile()->GetLocalGenerator()->
+ GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
+
+ if(runpaths.find(runpath) == runpaths.end())
+ {
+ os << indent << "execute_process(COMMAND " << installNameTool << "\n";
+ os << indent << " -add_rpath \"" << runpath << "\"\n";
+ os << indent << " \"" << toDestDirPath << "\")\n";
+ }
}
}
else