summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-10-06 22:24:10 -0600
committerBrad King <brad.king@kitware.com>2014-10-10 10:17:27 -0400
commit50e261ddb680f46e7011fe5173dc59d64b12c882 (patch)
treeeb9c50a632711793e412224a0e7b936aac55a726 /Source
parent9b98fd528da4821f316505e7dcc0b12510ae77bc (diff)
downloadcmake-50e261ddb680f46e7011fe5173dc59d64b12c882.tar.gz
OSX: Warn when attempting to change runtime paths on OS X 10.5
Even though 10.5 supports @rpath, the support is not complete enough for CMake. For instance, install_name_tool doesn't support adding and removing rpaths. Also modifying BundleUtilities test to remove an undesirable cmake generated runtime path. The intent was to build with the install rpath as is done with the other cases in this test.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmInstallTargetGenerator.cxx80
1 files changed, 53 insertions, 27 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 8a1c53e272..d689c89ae7 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -677,46 +677,72 @@ cmInstallTargetGenerator
return;
}
- if(this->Target->GetMakefile()->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
+ cmMakefile* mf = this->Target->GetMakefile();
+
+ if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
// If using install_name_tool, set up the rules to modify the rpaths.
std::string installNameTool =
- this->Target->GetMakefile()->
- GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
+ mf->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL");
std::vector<std::string> oldRuntimeDirs, newRuntimeDirs;
cli->GetRPath(oldRuntimeDirs, false);
cli->GetRPath(newRuntimeDirs, true);
- // 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)
- {
- std::string runpath = this->Target->GetMakefile()->GetLocalGenerator()->
- GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
+ std::string darwin_major_version_s =
+ mf->GetSafeDefinition("DARWIN_MAJOR_VERSION");
- 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";
- }
+ std::stringstream ss(darwin_major_version_s);
+ int darwin_major_version;
+ ss >> darwin_major_version;
+ if(!ss.fail() && darwin_major_version <= 9 &&
+ (!oldRuntimeDirs.empty() || !newRuntimeDirs.empty())
+ )
+ {
+ cmOStringStream msg;
+ msg << "WARNING: Target \"" << this->Target->GetName()
+ << "\" has runtime paths which cannot be changed during install. "
+ << "To change runtime paths, OS X version 10.6 or newer is required. "
+ << "Therefore, runtime paths will not be changed when installing. "
+ << "CMAKE_BUILD_WITH_INSTALL_RPATH may be used to work around"
+ " this limitation.";
+ mf->IssueMessage(cmake::WARNING, msg.str());
}
-
- runpaths.clear();
- for(std::vector<std::string>::const_iterator i = newRuntimeDirs.begin();
- i != newRuntimeDirs.end(); ++i)
+ else
{
- std::string runpath = this->Target->GetMakefile()->GetLocalGenerator()->
- GetGlobalGenerator()->ExpandCFGIntDir(*i, config);
+ // 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)
+ {
+ std::string runpath =
+ mf->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";
+ }
+ }
- if(runpaths.find(runpath) == runpaths.end())
+ 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 \"" << runpath << "\"\n";
- os << indent << " \"" << toDestDirPath << "\")\n";
+ std::string runpath =
+ mf->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";
+ }
}
}
}