summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-14 11:04:40 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-11-21 10:48:03 (GMT)
commit7521da2852a2fce16919b2640bcc0fa2f0c55b7d (patch)
tree54dcfafc4f481f1bbe2b873eb11e900140a2cb9a /Source/cmComputeLinkInformation.cxx
parente776a2dae4fe7dd6d20f15ec488019b95a9d648f (diff)
downloadCMake-7521da2852a2fce16919b2640bcc0fa2f0c55b7d.zip
CMake-7521da2852a2fce16919b2640bcc0fa2f0c55b7d.tar.gz
CMake-7521da2852a2fce16919b2640bcc0fa2f0c55b7d.tar.bz2
Introduce CMAKE_STAGING_PREFIX variable.
This variable can be useful in cross-compiling contexts where the sysroot is read-only or where the sysroot should otherwise remain pristine. If the new CMAKE_STAGING_PREFIX variable is set, it is used instead of CMAKE_INSTALL_PREFIX when generating the installation rules in cmake_install.cmake. This way, the CMAKE_INSTALL_PREFIX variable always refers to the installation prefix on the target device, regardless of whether host==target. If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX, the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX. Matching paths in the -rpath-link are not transformed. The cross-prefix usr-move workaround is assumed not to require extension regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX is still used to determine the workaround path, and that variable remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the generated export files are deployed to the target, the workaround will still be in place, and still be employed if required.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 3152c2a..0ef3d2e 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1902,6 +1902,10 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
if(use_build_rpath || use_link_rpath)
{
std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
+ const char *stagePath
+ = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX");
+ const char *installPrefix
+ = this->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
cmSystemTools::ConvertToUnixSlashes(rootPath);
std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
for(std::vector<std::string>::const_iterator ri = rdirs.begin();
@@ -1916,6 +1920,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
{
d = d.substr(rootPath.size());
}
+ else if (stagePath && *stagePath && d.find(stagePath) == 0)
+ {
+ std::string suffix = d.substr(strlen(stagePath));
+ d = installPrefix;
+ d += "/";
+ d += suffix;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ }
if(emitted.insert(d).second)
{
runtimeDirs.push_back(d);
@@ -1936,6 +1948,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
{
d = d.substr(rootPath.size());
}
+ else if (stagePath && *stagePath && d.find(stagePath) == 0)
+ {
+ std::string suffix = d.substr(strlen(stagePath));
+ d = installPrefix;
+ d += "/";
+ d += suffix;
+ cmSystemTools::ConvertToUnixSlashes(d);
+ }
if(emitted.insert(d).second)
{
runtimeDirs.push_back(d);